39#include <ogdf/basic/internal/config_autogen.h>
68 const Graph& primalGraph = CE.getGraph();
84 for (
face f : CE.faces) {
95 edge eDual = dualGraph.
newEdge(vDualSource, vDualTarget);
101 for (
face f : CE.faces) {
106 edge e = adj->theEdge();
113 dualGraph.
sort(vDual, newOrder);
120 edge ePrimal = v->firstAdj()->theEdge();
123 if (ePrimal->
source() == v) {
196 template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int>::type = 0>
207 node newPrimalNode {newPrimalEdge->source()};
211 oldDualEdge->adjSource()->faceCycleSucc())};
224#ifdef OGDF_HEAVY_DEBUG
228 return newPrimalEdge;
232 template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int>::type = 0>
244#ifdef OGDF_HEAVY_DEBUG
250 template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int>::type = 0>
277#ifdef OGDF_HEAVY_DEBUG
281 return newPrimalNode;
285 template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int>::type = 0>
299#ifdef OGDF_HEAVY_DEBUG
303 return newPrimalNode;
307 template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int>::type = 0>
325 edge newDualEdge {leftAdj->cyclicPred()->theEdge()};
337#ifdef OGDF_HEAVY_DEBUG
341 return newPrimalEdge;
345 template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int>::type = 0>
351 template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int>::type = 0>
357 template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int>::type = 0>
368#ifdef OGDF_HEAVY_DEBUG
372 return oldPrimalFace;
376 template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int>::type = 0>
395#ifdef OGDF_HEAVY_DEBUG
401 template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int>::type = 0>
406#ifdef OGDF_HEAVY_DEBUG
414 Embedding::consistencyCheck();
419 OGDF_ASSERT(primalGraph.numberOfEdges() == dualGraph.numberOfEdges());
422 for (
node vDual : dualGraph.nodes) {
425 for (
edge eDual : dualGraph.edges) {
432 for (
face fDual : Embedding::faces) {
449 template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int>::type = 0>
464 OGDF_ASSERT(dualAdjEntry->theNode() == oldDualNode);
486#ifdef OGDF_HEAVY_DEBUG
490 return newPrimalEdge;
Declaration of CombinatorialEmbedding and face.
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Declaration of doubly linked lists and iterators.
Basic declarations, included by all source files.
Class for adjacency list elements.
adjEntry faceCyclePred() const
Returns the cyclic predecessor in face.
edge theEdge() const
Returns the edge associated with this adjacency entry.
bool isSource() const
Returns true iff this is the source adjacency entry of the corresponding edge.
adjEntry cyclicPred() const
Returns the cyclic predecessor in the adjacency list.
node theNode() const
Returns the node whose adjacency list contains this element.
Combinatorial embeddings of planar graphs with modification functionality.
node splitNode(adjEntry adjStartLeft, adjEntry adjStartRight)
Splits a node while preserving the order of adjacency entries.
node contract(edge e, bool keepSelfLoops=false)
Contracts edge e while preserving the order of adjacency entries.
face joinFaces(edge e)
Removes edge e and joins the two faces adjacent to e.
void reverseEdge(edge e)
Reverses edges e and updates embedding.
void clear()
Removes all nodes, edges, and faces from the graph and the embedding.
const Graph & getGraph() const
Returns the associated graph.
edge splitFace(adjEntry adjSrc, adjEntry adjTgt, bool sourceAfter=false)
Splits a face by inserting a new edge.
Combinatorial embeddings of planar graphs.
const Graph * m_cpGraph
The associated graph.
face rightFace(adjEntry adj) const
Returns the face to the right of adj, i.e., the face containing adj.
void computeFaces()
Computes the list of faces.
face leftFace(adjEntry adj) const
Returns the face to the left of adj, i.e., the face containing the twin of adj.
int numberOfFaces() const
Returns the number of faces.
A dual graph including its combinatorial embedding of an embedded graph.
const face & primalFace(node v) const
Returns the face in the embedding of the primal graph corresponding to v.
void removeDeg1Primal(node v)
Removes degree-1 node v.
void consistencyCheck() const
Asserts that this embedding is consistent.
~DualGraphBase()
Destructor.
node splitNodePrimal(adjEntry adjStartLeft, adjEntry adjStartRight)
Splits a node while preserving the order of adjacency entries.
typename std::conditional< isConst, const ConstCombinatorialEmbedding, CombinatorialEmbedding >::type Embedding
FaceArray< node > m_dualNode
The corresponding node in the dual graph.
const face & dualFace(node v) const
Returns the face in the embedding of the dual graph corresponding to v.
FaceArray< node > m_primalNode
The corresponding node in the primal graph.
edge addEdgeToIsolatedNodePrimal(adjEntry adjSrc, node v)
Inserts a new edge similarly to splitFace without having to call computeFaces again.
Embedding & m_primalEmbedding
The embedding of the primal graph.
EdgeArray< edge > m_primalEdge
The corresponding edge in the primal graph.
face joinFacesPrimal(edge e)
Removes edge e and joins the two faces adjacent to e.
void reverseEdgePrimal(edge e)
Reverses edges e and updates embedding.
edge splitPrimal(edge e)
Splits edge e=(v,w) into e=(v,u) and e'=(u,w) creating a new node u.
edge splitFacePrimal(adjEntry adjSrc, adjEntry adjTgt, bool sourceAfter=false)
Splits a face by inserting a new edge.
void unsplitPrimal(edge eIn, edge eOut)
Undoes a split operation.
const edge & primalEdge(edge e) const
Returns the edge in the primal graph corresponding to e.
node contractPrimal(edge e, bool keepSelfLoops=false)
Contracts edge e while preserving the order of adjacency entries.
NodeArray< face > m_dualFace
The corresponding face in embedding of the dual graph.
const Graph & getPrimalGraph() const
Returns a reference to the primal graph.
DualGraphBase(Embedding &CE)
Constructor; creates dual graph and its combinatorial embedding.
const node & dualNode(face f) const
Returns the node in the dual graph corresponding to f.
Embedding & getPrimalEmbedding() const
Returns a reference to the combinatorial embedding of the primal graph.
edge addEdgeToIsolatedNodePrimal(adjEntry adj, node v, bool adjSrc)
Inserts a new edge similarly to splitFace without having to call computeFaces again.
const node & primalNode(face f) const
Returns the node in the primal graph corresponding to f.
adjEntry dualAdj(adjEntry primalAdj, bool reverse=false)
Returns the corresponding adjEntry of the dual edge of primalAdj (or the opposite adjEntry of the dua...
EdgeArray< edge > m_dualEdge
The corresponding edge in the dual graph.
const edge & dualEdge(edge e) const
Returns the edge in the dual graph corresponding to e.
NodeArray< face > m_primalFace
The corresponding facee in the embedding of the primal graph.
edge addEdgeToIsolatedNodePrimal(node v, adjEntry adjTgt)
Inserts a new edge similarly to splitFace without having to call computeFaces again.
Class for the representation of edges.
adjEntry adjSource() const
Returns the corresponding adjacancy entry at source node.
node opposite(node v) const
Returns the adjacent node different from v.
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.
RegisteredArray for labeling the faces of a CombinatorialEmbedding.
Faces in a combinatorial embedding.
Data type for general directed graphs (adjacency list representation).
void sort(node v, const ADJ_ENTRY_LIST &newOrder)
Sorts the adjacency list of node v according to newOrder.
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.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Doubly linked lists (maintaining the length of the list).
iterator pushBack(const E &x)
Adds element x at the end of the list.
Class for the representation of nodes.
int degree() const
Returns the degree of the node (indegree + outdegree).
adjEntry firstAdj() const
Returns the first entry in the adjaceny list.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
RegisteredArray for nodes, edges and adjEntries of a graph.
Decralation of graph iterators.
Reverse< T > reverse(T &container)
Provides iterators for container to make it easily iterable in reverse.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
The namespace for all OGDF objects.