45 template<
class BaseEmbedder,
class T>
60 SG, m_adjExternal, nodeLengthSG, edgeLengthSG, nodeInBlockSG);
67 if (*BaseEmbedder::pAdjExternal ==
nullptr) {
68 node on = BaseEmbedder::pBCTree->original(nSG_to_nG[m_adjExternal->
theNode()]);
71 if (ae->
theEdge() == BaseEmbedder::pBCTree->original(eSG_to_eG[m_adjExternal->
theEdge()])) {
72 *BaseEmbedder::pAdjExternal = ae->
twin();
78 bool DGcomputed =
false;
83 Graph* p_DG =
nullptr;
90 node nH = nSG_to_nG[nSG];
91 node nG = BaseEmbedder::pBCTree->original(nH);
95 if (BaseEmbedder::pBCTree->bcproper(nG) == cT) {
102 node cT2 = BaseEmbedder::pBCTree->bcproper(nG);
103 bool doRecurse =
true;
106 node parent_bT_of_cT2 =
nullptr;
111 if (e_cT2_to_bT2->
source() == cT2) {
112 parent_bT_of_cT2 = e_cT2_to_bT2->
target();
119 if (BaseEmbedder::treeNodeTreated[parent_bT_of_cT2]) {
126 bool aeExtExists =
false;
128 if (aeFace->
theNode() == nSG) {
146 p_adjacencyList->
init(SG);
149 (*p_adjacencyList)[nBG].pushBack(ae_nBG);
156 if (!adjEntryTreated[nBG].search(adj).valid()) {
162 adjEntryTreated[adj2->
theNode()].pushBack(adj2);
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]].search((*p_fPG_to_nDG)[f2_id]).
valid()
206 && !adjFaces[(*p_fPG_to_nDG)[f2_id]].search((*p_fPG_to_nDG)[f1_id]).
valid()) {
207 adjFaces[(*p_fPG_to_nDG)[f1_id]].pushBack((*p_fPG_to_nDG)[f2_id]);
208 p_DG->
newEdge((*p_fPG_to_nDG)[f1_id], (*p_fPG_to_nDG)[f2_id]);
223 for (
edge e : DG_edges) {
224 node s = e->source();
225 node t = e->target();
230 node efDG = (*p_fPG_to_nDG)[extFaceID];
232 p_distances->
init(*p_DG);
234 shortestPath.
call(*p_DG, efDG, el, *p_distances, pi);
239 int optFaceDist = -1;
241 for (
int fID = 0; fID < p_faces->
size(); ++fID) {
244 bool contains_nSG =
false;
247 if (adj->theNode() == nSG) {
255 int thisDist = (*p_distances)[(*p_fPG_to_nDG)[fID]];
257 if (optFaceDist == -1 || optFaceDist > thisDist) {
259 optFaceDist = thisDist;
269 if (!BaseEmbedder::treeNodeTreated[bT2]) {
270 this->embedBlock(bT2, cT2, *pAfter);
277 bool after_ae =
true;
278 for (
adjEntry aeNode = ae; after_ae || aeNode != ae; aeNode = aeNode->
succ() ==
nullptr ? nSG->
firstAdj() : aeNode->
succ()) {
279 edge eG = BaseEmbedder::pBCTree->original(eSG_to_eG[aeNode->theEdge()]);
281 if (pAfter->
valid()) {
282 *pAfter = BaseEmbedder::newOrder[nG].insertAfter(eG->
adjSource(), *pAfter);
284 *pAfter = BaseEmbedder::newOrder[nG].pushBack(eG->
adjSource());
287 if (pAfter->
valid()) {
288 *pAfter = BaseEmbedder::newOrder[nG].insertAfter(eG->
adjTarget(), *pAfter);
290 *pAfter = BaseEmbedder::newOrder[nG].pushBack(eG->
adjTarget());
294 after_ae &= aeNode->
succ() !=
nullptr;
297 if (*pAfter != after) {
305 delete p_adjacencyList;
node target() const
Returns the target node of the edge.
Common functionality for layer-based embedding algorithms.
edge theEdge() const
Returns the edge associated with this adjacency entry.
ListIteratorBase< E, isConst, isReverse > succ() const
Returns successor iterator.
iterator pushBack(const E &x)
Adds element x at the end of the list.
Data type for general directed graphs (adjacency list representation).
adjEntry adjSource() const
Returns the corresponding adjacancy entry at source node.
void init()
Reinitializes the array. Associates the array with no graph.
adjEntry firstAdj() const
Returns the first adjacency element in the face.
void push(E e)
Puts a new element in the buffer.
An array that keeps track of the number of inserted elements; also usable as an efficient stack...
const_iterator cyclicPred(const_iterator it) const
Returns a const iterator to the cyclic predecessor of it.
Declaration of CombinatorialEmbedding and face.
Dynamic arrays indexed with edges.
Computes single-source shortest-paths with Bellman-Ford-Moore's algorithm.
bool valid() const
Returns true iff the iterator points to an element.
Declaration of class BCTree.
constexpr double pi
The constant .
Dynamic arrays indexed with nodes.
int size() const
Returns the size (number of elements) of the array.
virtual bool call(const Graph &G, const node s, const EdgeArray< int > &length, NodeArray< int > &d, NodeArray< edge > &pi) override
Doubly linked lists (maintaining the length of the list).
edge newEdge(node v, node w)
Creates a new edge (v,w) and returns it.
internal::FaceAdjContainer entries
Container maintaining the adjacency entries in the face.
Faces in a combinatorial embedding.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Class for the representation of edges.
adjEntry twin() const
Returns the corresponding adjacency element associated with the same edge.
const_iterator get(int pos) const
Returns a const iterator pointing to the element at position pos.
Class for the representation of nodes.
bool valid() const
Returns true iff the array is associated with a graph.
Encapsulates a pointer to a list element.
node opposite(node v) const
Returns the adjacent node different from v.
adjEntry succ() const
Returns the successor in the adjacency list.
int size() const
Returns the number of elements in the list.
face leftFace(adjEntry adj) const
Returns the face to the left of adj, i.e., the face containing the twin of adj.
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.
node source() const
Returns the source node of the edge.
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)
Computes an embedding of a biconnected graph with maximum external face.
The namespace for all OGDF objects.
void allEdges(CONTAINER &edgeContainer) const
Returns a container with all edges of the graph.
Declaration of class ShortestPathWithBFM which computes shortest paths via Bellman-Ford-Moore.
void init()
Reinitializes the array, clearing it, and without initial memory allocation.
node newNode()
Creates a new node and returns it.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
adjEntry firstAdj() const
Returns the first entry in the adjaceny list.
Combinatorial embeddings of planar graphs with modification functionality.
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...
adjEntry adjTarget() const
Returns the corresponding adjacancy entry at target node.
node theNode() const
Returns the node whose adjacency list contains this element.
Class for adjacency list elements.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.