49template<
class BaseEmbedder,
class T>
58 edgeLengthSG, nodeInBlockSG);
65 if (*BaseEmbedder::pAdjExternal ==
nullptr) {
66 node on = BaseEmbedder::pBCTree->original(nSG_to_nG[m_adjExternal->
theNode()]);
70 == BaseEmbedder::pBCTree->original(eSG_to_eG[m_adjExternal->
theEdge()])) {
71 *BaseEmbedder::pAdjExternal = ae->twin();
77 bool DGcomputed =
false;
82 Graph* p_DG =
nullptr;
89 node nH = nSG_to_nG[nSG];
90 node nG = BaseEmbedder::pBCTree->original(nH);
94 if (BaseEmbedder::pBCTree->bcproper(nG) == cT) {
101 node cT2 = BaseEmbedder::pBCTree->bcproper(nG);
102 bool doRecurse =
true;
105 node parent_bT_of_cT2 =
nullptr;
108 edge e_cT2_to_bT2 = adj->theEdge();
110 if (e_cT2_to_bT2->
source() == cT2) {
111 parent_bT_of_cT2 = e_cT2_to_bT2->
target();
118 if (BaseEmbedder::treeNodeTreated[parent_bT_of_cT2]) {
125 bool aeExtExists =
false;
127 if (aeFace->theNode() == nSG) {
128 ae = aeFace->
succ() ==
nullptr ? nSG->firstAdj() : aeFace->
succ();
145 p_adjacencyList->
init(SG);
147 for (
adjEntry ae_nBG : nBG->adjEntries) {
148 (*p_adjacencyList)[nBG].pushBack(ae_nBG);
154 for (
adjEntry adj : nBG->adjEntries) {
155 if (!adjEntryTreated[nBG].search(adj).valid()) {
161 adjEntryTreated[adj2->
theNode()].pushBack(adj2);
163 (*p_adjacencyList)[adj2->
twinNode()];
165 }
while (adj2 != adj);
167 p_faces->pushBack(newFace);
172 for (
int i = 0; i < p_faces->size(); i++) {
187 bool do_break =
false;
190 if (adj4 == adj2->twin()) {
205 && !adjFaces[(*p_fPG_to_nDG)[f1_id]]
206 .search((*p_fPG_to_nDG)[f2_id])
208 && !adjFaces[(*p_fPG_to_nDG)[f2_id]]
209 .search((*p_fPG_to_nDG)[f1_id])
211 adjFaces[(*p_fPG_to_nDG)[f1_id]].pushBack(
212 (*p_fPG_to_nDG)[f2_id]);
213 p_DG->
newEdge((*p_fPG_to_nDG)[f1_id], (*p_fPG_to_nDG)[f2_id]);
228 for (
edge e : DG_edges) {
229 node s = e->source();
230 node t = e->target();
235 node efDG = (*p_fPG_to_nDG)[extFaceID];
237 p_distances->
init(*p_DG);
239 shortestPath.
call(*p_DG, efDG, el, *p_distances, pi);
244 int optFaceDist = -1;
246 for (
int fID = 0; fID < p_faces->
size(); ++fID) {
249 bool contains_nSG =
false;
252 if (adj->theNode() == nSG) {
260 int thisDist = (*p_distances)[(*p_fPG_to_nDG)[fID]];
262 if (optFaceDist == -1 || optFaceDist > thisDist) {
264 optFaceDist = thisDist;
265 ae = ae_nSG->
succ() ==
nullptr ? nSG->firstAdj() : ae_nSG->
succ();
272 node bT2 = adj->theEdge()->opposite(cT2);
274 if (!BaseEmbedder::treeNodeTreated[bT2]) {
275 this->embedBlock(bT2, cT2, *pAfter);
282 bool after_ae =
true;
283 for (
adjEntry aeNode = ae; after_ae || aeNode != ae;
284 aeNode = aeNode->
succ() ==
nullptr ? nSG->firstAdj() : aeNode->succ()) {
285 edge eG = BaseEmbedder::pBCTree->original(eSG_to_eG[aeNode->theEdge()]);
287 if (pAfter->
valid()) {
288 *pAfter = BaseEmbedder::newOrder[nG].insertAfter(eG->
adjSource(), *pAfter);
290 *pAfter = BaseEmbedder::newOrder[nG].pushBack(eG->
adjSource());
293 if (pAfter->
valid()) {
294 *pAfter = BaseEmbedder::newOrder[nG].insertAfter(eG->
adjTarget(), *pAfter);
296 *pAfter = BaseEmbedder::newOrder[nG].pushBack(eG->
adjTarget());
300 after_ae &= aeNode->
succ() !=
nullptr;
303 if (*pAfter !=
after) {
311 delete p_adjacencyList;
Declaration and implementation of ArrayBuffer class.
Declaration of class BCTree.
Declaration of CombinatorialEmbedding and face.
Computes an embedding of a biconnected graph with maximum external face.
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Declaration of doubly linked lists and iterators.
Declaration of class ShortestPathWithBFM which computes shortest paths via Bellman-Ford-Moore.
Basic declarations, included by all source files.
Class for adjacency list elements.
adjEntry twin() const
Returns the corresponding adjacency element associated with the same edge.
adjEntry succ() const
Returns the successor in the adjacency list.
edge theEdge() const
Returns the edge associated with this adjacency entry.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
node theNode() const
Returns the node whose adjacency list contains this element.
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
void push(E e)
Puts a new element in the buffer.
Combinatorial embeddings of planar graphs with modification functionality.
face leftFace(adjEntry adj) const
Returns the face to the left of adj, i.e., the face containing the twin of adj.
Class for the representation of edges.
adjEntry adjSource() const
Returns the corresponding adjacancy entry at source node.
adjEntry adjTarget() const
Returns the corresponding adjacancy entry at target node.
node target() const
Returns the target node of the edge.
node source() const
Returns the source node of the edge.
static void embed(Graph &G, adjEntry &adjExternal, const NodeArray< T > &nodeLength, const EdgeArray< T > &edgeLength, const node &n=nullptr)
Embeds G by computing and extending a maximum face in G containing n.
Faces in a combinatorial embedding.
internal::FaceAdjContainer entries
Container maintaining the adjacency entries in the face.
adjEntry firstAdj() const
Returns the first adjacency element in the face.
Data type for general directed graphs (adjacency list representation).
void allEdges(CONTAINER &edgeContainer) const
Returns a container with all edges of the graph.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
node newNode(int index=-1)
Creates a new node and returns it.
edge newEdge(node v, node w, int index=-1)
Creates a new edge (v,w) and returns it.
Doubly linked lists (maintaining the length of the list).
int size() const
Returns the number of elements in the list.
iterator pushBack(const E &x)
Adds element x at the end of the list.
Encapsulates a pointer to a list element.
bool valid() const
Returns true iff the iterator points to an element.
ListIteratorBase< E, isConst, isReverse > succ() const
Returns successor iterator.
const_iterator cyclicPred(const_iterator it) const
Returns a const iterator to the cyclic predecessor of it.
const_iterator get(int pos) const
Returns a const iterator pointing to the element at position pos.
ListConstIterator< E > search(const E &e) const
Scans the list for the specified element and returns an iterator to the first occurrence in the list,...
Class for the representation of nodes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
void init(const Base *base=nullptr)
Reinitializes the array. Associates the array with the matching registry of base.
Computes single-source shortest-paths with Bellman-Ford-Moore's algorithm.
virtual bool call(const Graph &G, const node s, const EdgeArray< int > &length, NodeArray< int > &d, NodeArray< edge > &pi) override
Common functionality for layer-based embedding algorithms.
void internalEmbedBlock(Graph &SG, NodeArray< T > &nodeLengthSG, EdgeArray< T > &edgeLengthSG, NodeArray< node > &nSG_to_nG, EdgeArray< edge > &eSG_to_eG, node nodeInBlockSG, node cT, ListIterator< adjEntry > &after)
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
RegisteredArray for nodes, edges and adjEntries of a graph.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
The namespace for all OGDF objects.