56 namespace boyer_myrvold {
57 class BoyerMyrvoldInit;
100 bool limitStructures,
104 bool extractSubgraph,
106 :
BoyerMyrvoldPlanar(g, bundles, static_cast<int>(embeddingGrade), limitStructures, output, randomness, avoidE2Minors, extractSubgraph, edgeCosts)
124 bool deleteFlipFlags);
134 void seed(
const std::minstd_rand rand) {
145 return m_dfi[w] > 0 && (!m_backedgeFlags[w].empty() || !m_pertinentRoots[w].empty());
151 return m_dfi[w] > 0 && pertinent(w) && !externallyActive(w, v);
157 if (m_dfi[w] <= 0)
return false;
158 if (m_leastAncestor[w] < v)
return true;
159 return !m_separatedDFSChildList[w].empty() && m_lowPoint[m_separatedDFSChildList[w].front()] < v;
165 if (m_dfi[w] <= 0)
return true;
166 if (!m_backedgeFlags[w].empty() || !m_pertinentRoots[w].empty()
167 || m_leastAncestor[w] < v)
return false;
168 return m_separatedDFSChildList[w].empty() || m_lowPoint[m_separatedDFSChildList[w].front()] >= v;
181 if (m_dfi[w] <= 0)
return 0;
182 if (!m_pertinentRoots[w].empty() || !m_backedgeFlags[w].empty()) {
184 if (m_leastAncestor[w] < v)
return 2;
185 if (m_separatedDFSChildList[w].empty())
return 1;
186 return m_lowPoint[m_separatedDFSChildList[w].front()] < v ? 2 : 1;
189 if (m_leastAncestor[w] < v)
return 3;
190 if (m_separatedDFSChildList[w].empty())
return 0;
191 return m_lowPoint[m_separatedDFSChildList[w].front()] < v ? 3 : 0;
206 adjEntry adj = m_link[direction][w];
209 if (w->
degree() > 1) direction =
221 adjEntry adj = beforeShortCircuitEdge(w,direction);
224 if (w->
degree() > 1) direction =
236 return m_link[direction][v]->theNode();
245 return beforeShortCircuitEdge(v,direction)->theNode();
254 return (m_beforeSCE[direction][v]==
nullptr) ? m_link[direction][v] : m_beforeSCE[direction][v];
260 node activeSuccessor(
node w,
int& direction,
int v,
int& info);
266 return activeSuccessor(w,direction,v,info);
277 bool between =
false;
278 while (root !=
nullptr) {
279 root = successorOnExternalFace(root,dir);
280 if (between && pertinent(root)) {
283 if (root == stopx || root == stopy) {
295 cout <<
"\nprintNodeInfo(" << m_dfi[v] <<
"): ";
300 cout <<
"\tadjList: ";
310 void mergeBiconnectedComponent(
StackPure<int>& stack,
const int j);
315 void mergeBiconnectedComponentOnlyPlanar(
StackPure<int>& stack,
const int j);
320 void embedBackedges(
const node v,
const int v_dir,
321 const node w,
const int w_dir,
const int i);
326 void embedBackedgesOnlyPlanar(
const node v,
const int v_dir,
327 const node w,
const int w_dir,
const int i);
330 void createShortCircuitEdge(
const node v,
const int v_dir,
331 const node w,
const int w_dir);
349 void mergeUnprocessedNodes();
354 void postProcessEmbedding();
378 bool m_extractSubgraph =
true;
474 return lhs >
static_cast<int>(rhs);
478 return lhs ==
static_cast<int>(rhs);
482 return lhs !=
static_cast<int>(rhs);
486 return lhs <= static_cast<int>(rhs);
Declaration of singly linked lists and iterators.
NodeArray< ListPure< node > > m_separatedDFSChildList
A list to all separated DFS-children of node.
Wrapper class used for preprocessing and valid invocation of the planarity test.
Data type for general directed graphs (adjacency list representation).
bool inactive(node w, int v)
Checks whether real node w is inactive while embedding node with DFI v.
NodeArray< node > m_realVertex
Link to non-virtual vertex of a virtual Vertex.
Array< node > m_nodeFromDFI
Returns appropriate node from given DFI.
NodeArray< int > m_visitedWithBackedge
Keeps track of all vertices that are visited by the walkup through a specific backedge.
EmbeddingGrade
Denotes the different embedding options.
int degree() const
Returns the degree of the node (indegree + outdegree).
node constActiveSuccessor(node w, int direction, int v, int &info)
Walks upon external face in the given direction (without changing it) until an active vertex is reach...
const double m_randomness
A Kuratowski Structure is a special graph structure containing severals subdivisions.
node successorOnExternalFace(node w, int &direction)
Walks upon external face in the given direction starting at w.
NodeArray< int > m_lowPoint
The lowpoint of each node.
NodeArray< int > m_leastAncestor
The DFI of the least ancestor node over all backedges.
node constSuccessorOnExternalFace(node v, int direction)
Returns the successornode on the external face in given direction.
const bool m_limitStructures
int infoAboutNode(node w, int v)
Checks all dynamic information about a node w while embedding node with DFI v.
NodeArray< bool > m_flipped
Iff true, the node is the root of a bicomp which has to be flipped.
EdgeArray< BoyerMyrvoldEdgeType > m_edgeType
Contains the type of each edge.
bool operator>(int lhs, BoyerMyrvoldPlanar::EmbeddingGrade rhs)
adjEntry beforeShortCircuitEdge(node v, int direction)
Returns underlying former adjEntry, if a short circuit edge in direction of v exists.
void printNodeInfo(node v)
Prints informations about node v.
NodeArray< ListIterator< node > > m_pNodeInParent
Pointer to node contained in the DFSChildList of his parent, if exists.
This class is used in the Boyer-Myrvold planarity test for preprocessing purposes.
NodeArray< adjEntry > m_adjParent
The adjEntry which goes from DFS-parent to current vertex.
NodeArray< int > m_visited
This Array keeps track of all vertices that are visited by current walkup.
Declaration and implementation of EdgeArray class.
node successorWithoutShortCircuit(node w, int &direction)
Walks upon external face in given direction avoiding short circuit edges.
const bool m_avoidE2Minors
const int m_embeddingGrade
bool externallyActive(node w, int v)
Checks whether real node w is externally active while embedding node with DFI v.
Graph & m_g
Input graph, which can be altered.
bool pertinent(node w)
Checks whether node w is pertinent. w has to be non-virtual.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Class for the representation of edges.
NodeArray< SListPure< node > > m_pertinentRoots
List of virtual bicomp roots, that are pertinent to the current embedded node.
Class for the representation of nodes.
Declaration and implementation of NodeArray class.
const EdgeArray< int > * m_edgeCosts
NodeArray< SListPure< adjEntry > > m_backedgeFlags
Holds information, if node is the source of a backedge.
This class collects information about Kuratowski Subdivisions which is used for extraction later...
NodeArray< int > m_highestSubtreeDFI
The highest DFI in a subtree with node as root.
EdgeArray< node > m_pointsToRoot
Identifies the rootnode of the child bicomp the given backedge points to.
bool wNodesExist(node root, node stopx, node stopy)
Checks, if one ore more wNodes exist between the two stopping vertices stopx and stopy.
void seed(const std::minstd_rand rand)
Seeds the random generator for performing a random DFS. If this method is never called the random gen...
int m_flippedNodes
The whole number of bicomps, which have to be flipped.
This class implements the extended BoyerMyrvold planarity embedding algorithm.
static const int DirectionCCW
Direction for counterclockwise traversal.
BoyerMyrvoldPlanar(Graph &g, bool bundles, EmbeddingGrade embeddingGrade, bool limitStructures, SListPure< KuratowskiStructure > &output, double randomness, bool avoidE2Minors, bool extractSubgraph, const EdgeArray< int > *edgeCosts=nullptr)
Constructor, for parameters see BoyerMyrvold.
adjEntry succ() const
Returns the successor in the adjacency list.
static const int DirectionCW
Direction for clockwise traversal.
bool internallyActive(node w, int v)
Checks whether real node w is internally active while embedding node with DFI v.
node constSuccessorWithoutShortCircuit(node v, int direction)
Walks upon external face in direction avoiding short circuit edges.
NodeArray< int > m_dfi
The one and only DFI-NodeArray.
The namespace for all OGDF objects.
bool operator<=(int lhs, BoyerMyrvoldPlanar::EmbeddingGrade rhs)
BoyerMyrvoldEdgeType
Type of edge.
adjEntry firstAdj() const
Returns the first entry in the adjaceny list.
bool operator==(const Tuple2< E1, E2 > &t1, const Tuple2< E1, E2 > &t2)
Equality operator for 2-tuples.
node theNode() const
Returns the node whose adjacency list contains this element.
bool operator!=(const Tuple2< E1, E2 > &t1, const Tuple2< E1, E2 > &t2)
Inequality operator for 2-tuples.
Class for adjacency list elements.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Declaration of doubly linked lists and iterators.
Declaration and implementation of list-based stacks (StackPure<E> and Stack<E>).
SListPure< KuratowskiStructure > & m_output
Data structure for the Kuratowski subdivisions, which will be returned.