A dual graph including its combinatorial embedding of an embedded graph. More...
#include <ogdf/basic/DualGraph.h>
Public Types | |
using | Embedding = typename std::conditional< isConst, const ConstCombinatorialEmbedding, CombinatorialEmbedding >::type |
Public Types inherited from ogdf::ConstCombinatorialEmbedding | |
using | face_iterator = internal::GraphIterator< face > |
Provides a bidirectional iterator to a face in a combinatorial embedding. | |
Public Member Functions | |
DualGraphBase (Embedding &CE) | |
Constructor; creates dual graph and its combinatorial embedding. | |
~DualGraphBase () | |
Destructor. | |
Embedding & | getPrimalEmbedding () const |
Returns a reference to the combinatorial embedding of the primal graph. | |
const Graph & | getPrimalGraph () const |
Returns a reference to the primal graph. | |
Lookup functions | |
const node & | primalNode (face f) const |
Returns the node in the primal graph corresponding to f . | |
const edge & | primalEdge (edge e) const |
Returns the edge in the primal graph corresponding to e . | |
const face & | primalFace (node v) const |
Returns the face in the embedding of the primal graph corresponding to v . | |
const node & | dualNode (face f) const |
Returns the node in the dual graph corresponding to f . | |
const edge & | dualEdge (edge e) const |
Returns the edge in the dual graph corresponding to e . | |
const face & | dualFace (node v) const |
Returns the face in the embedding of the dual graph corresponding to v . | |
Public Member Functions inherited from ogdf::CombinatorialEmbedding | |
CombinatorialEmbedding (Graph &G) | |
Creates a combinatorial embedding of graph G . | |
const Graph & | getGraph () const |
Returns the associated graph. | |
Graph & | getGraph () |
operator const Graph & () const | |
operator Graph & () | |
void | init (Graph &G) |
Initializes the embedding for graph G . | |
void | clear () |
Removes all nodes, edges, and faces from the graph and the embedding. | |
edge | split (edge e) |
Splits edge e= (v,w) into e=(v,u) and e'=(u,w) creating a new node u. | |
void | unsplit (edge eIn, edge eOut) |
Undoes a split operation. | |
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. | |
edge | splitFace (adjEntry adjSrc, adjEntry adjTgt, bool sourceAfter=false) |
Splits a face by inserting a new edge. | |
edge | addEdgeToIsolatedNode (node v, adjEntry adjTgt) |
Inserts a new edge similarly to splitFace without having to call computeFaces again. | |
edge | addEdgeToIsolatedNode (adjEntry adjSrc, node v) |
Inserts a new edge similarly to splitFace without having to call computeFaces again. | |
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 | moveBridge (adjEntry adjBridge, adjEntry adjBefore) |
Moves a bridge in the graph. | |
void | removeDeg1 (node v) |
Removes degree-1 node v . | |
void | updateMerger (edge e, face fRight, face fLeft) |
Update face information after inserting a merger in a copy graph. | |
Public Member Functions inherited from ogdf::ConstCombinatorialEmbedding | |
ConstCombinatorialEmbedding (const Graph &G) | |
Creates a combinatorial embedding of graph G . | |
ConstCombinatorialEmbedding (const ConstCombinatorialEmbedding &C) | |
Copy constructor. | |
ConstCombinatorialEmbedding & | operator= (const ConstCombinatorialEmbedding &C) |
Assignment operator. | |
bool | valid () const |
Returns whether the embedding is associated with a graph. | |
const Graph & | getGraph () const |
Returns the associated graph of the combinatorial embedding. | |
operator const Graph & () const | |
Returns associated graph. | |
face | firstFace () const |
Returns the first face in the list of all faces. | |
face | lastFace () const |
Returns the last face in the list of all faces. | |
int | numberOfFaces () const |
Returns the number of faces. | |
face | rightFace (adjEntry adj) const |
Returns the face to the right of adj , i.e., the face containing adj . | |
face | leftFace (adjEntry adj) const |
Returns the face to the left of adj , i.e., the face containing the twin of adj . | |
int | maxFaceIndex () const |
Returns the largest used face index. | |
int | faceArrayTableSize () const |
Returns the table size of face arrays associated with this embedding. | |
face | chooseFace (std::function< bool(face)> includeFace=[](face) { return true;}, bool isFastTest=true) const |
Returns a random face. | |
face | maximalFace () const |
Returns a face of maximal size. | |
face | externalFace () const |
Returns the external face. | |
void | setExternalFace (face f) |
Sets the external face to f . | |
bool | isBridge (edge e) const |
void | init (const Graph &G) |
Initializes the embedding for graph G . | |
void | init () |
void | computeFaces () |
Computes the list of faces. | |
ListIterator< FaceArrayBase * > | registerArray (FaceArrayBase *pFaceArray) const |
Registers the face array pFaceArray . | |
void | unregisterArray (ListIterator< FaceArrayBase * > it) const |
Unregisters the face array identified by it . | |
void | moveRegisterArray (ListIterator< FaceArrayBase * > it, FaceArrayBase *pFaceArray) const |
Move the registration it of a node array to pFaceArray (used with move semantics for face arrays). | |
adjEntry | findCommonFace (const node v, const node w, bool left=true) const |
Identifies a common face of two nodes and returns the respective adjacency entry. | |
adjEntry | findCommonFace (const node v, const node w, adjEntry &adjW, bool left=true) const |
Identifies a common face of two nodes and returns the respective adjacency entry. | |
Updating the dual graph (also updates primal embedding) | |
Embedding & | m_primalEmbedding |
The embedding of the primal graph. | |
FaceArray< node > | m_primalNode |
The corresponding node in the primal graph. | |
NodeArray< face > | m_primalFace |
The corresponding facee in the embedding of the primal graph. | |
EdgeArray< edge > | m_primalEdge |
The corresponding edge in the primal graph. | |
FaceArray< node > | m_dualNode |
The corresponding node in the dual graph. | |
NodeArray< face > | m_dualFace |
The corresponding face in embedding of the dual graph. | |
EdgeArray< edge > | m_dualEdge |
The corresponding edge in the dual graph. | |
template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int >::type = 0> | |
edge | splitPrimal (edge e) |
Splits edge e= (v,w) into e=(v,u) and e'=(u,w) creating a new node u. | |
template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int >::type = 0> | |
void | unsplitPrimal (edge eIn, edge eOut) |
Undoes a split operation. | |
template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int >::type = 0> | |
node | splitNodePrimal (adjEntry adjStartLeft, adjEntry adjStartRight) |
Splits a node while preserving the order of adjacency entries. | |
template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int >::type = 0> | |
node | contractPrimal (edge e, bool keepSelfLoops=false) |
Contracts edge e while preserving the order of adjacency entries. | |
template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int >::type = 0> | |
edge | splitFacePrimal (adjEntry adjSrc, adjEntry adjTgt, bool sourceAfter=false) |
Splits a face by inserting a new edge. | |
template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int >::type = 0> | |
edge | addEdgeToIsolatedNodePrimal (node v, adjEntry adjTgt) |
Inserts a new edge similarly to splitFace without having to call computeFaces again. | |
template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int >::type = 0> | |
edge | addEdgeToIsolatedNodePrimal (adjEntry adjSrc, node v) |
Inserts a new edge similarly to splitFace without having to call computeFaces again. | |
template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int >::type = 0> | |
face | joinFacesPrimal (edge e) |
Removes edge e and joins the two faces adjacent to e . | |
template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int >::type = 0> | |
void | removeDeg1Primal (node v) |
Removes degree-1 node v . | |
template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int >::type = 0> | |
void | reverseEdgePrimal (edge e) |
Reverses edges e and updates embedding. | |
template<bool isConstSFINAE = isConst, typename std::enable_if<!isConstSFINAE, int >::type = 0> | |
edge | addEdgeToIsolatedNodePrimal (adjEntry adj, node v, bool adjSrc) |
Inserts a new edge similarly to splitFace without having to call computeFaces again. | |
adjEntry | dualAdj (adjEntry primalAdj, bool reverse=false) |
Returns the corresponding adjEntry of the dual edge of primalAdj (or the opposite adjEntry of the dual edge if reverse is set). | |
Additional Inherited Members | |
Public Attributes inherited from ogdf::ConstCombinatorialEmbedding | |
internal::GraphObjectContainer< FaceElement > | faces |
The container containing all face objects. | |
Protected Member Functions inherited from ogdf::ConstCombinatorialEmbedding | |
face | createFaceElement (adjEntry adjFirst) |
Create a new face. | |
void | reinitArrays () |
Reinitialize associated face arrays. | |
Protected Attributes inherited from ogdf::ConstCombinatorialEmbedding | |
const Graph * | m_cpGraph |
The associated graph. | |
face | m_externalFace |
int | m_faceArrayTableSize |
The current table size of face arrays. | |
int | m_faceIdCount |
The index assigned to the next created face. | |
std::mutex | m_mutexRegArrays |
The critical section for protecting shared acces to register/unregister methods. | |
ListPure< FaceArrayBase * > | m_regFaceArrays |
The external face. | |
AdjEntryArray< face > | m_rightFace |
The face to which an adjacency entry belongs. | |
A dual graph including its combinatorial embedding of an embedded graph.
Dual edges are rotated counter-clockwise compared to the primal ones.
Definition at line 56 of file DualGraph.h.
using ogdf::DualGraphBase< isConst >::Embedding = typename std::conditional<isConst, const ConstCombinatorialEmbedding, CombinatorialEmbedding>::type |
Definition at line 58 of file DualGraph.h.
|
inlineexplicit |
Constructor; creates dual graph and its combinatorial embedding.
Definition at line 62 of file DualGraph.h.
|
inline |
Destructor.
Definition at line 130 of file DualGraph.h.
|
inlineprivate |
Inserts a new edge similarly to splitFace without having to call computeFaces again.
adj | The adjacency entry belonging to the face that we want to insert the new edge into |
v | The degree 0 node. |
adjSrc | whether v will be the target node. |
Definition at line 445 of file DualGraph.h.
|
inline |
Inserts a new edge similarly to splitFace without having to call computeFaces again.
Creates a new edge from the node of adjSrc
to the degree 0 node v
. The face that adjSrc
belongs to is split.
Definition at line 347 of file DualGraph.h.
|
inline |
Inserts a new edge similarly to splitFace without having to call computeFaces again.
Creates a new edge from the degree 0 node v
to the node of adjTgt
. The face that adjTgt
belongs to is split.
Definition at line 341 of file DualGraph.h.
|
inline |
Contracts edge e
while preserving the order of adjacency entries.
e | is the edge to be contracted. |
keepSelfLoops | determines whether edges parallel to e will result in self-loops or not (in the latter case, they will also be contracted). |
e
to which all edges have been moved. The implementation ensures this to be the source of the former edge e
. Definition at line 281 of file DualGraph.h.
|
inlineprivate |
Returns the corresponding adjEntry of the dual edge of primalAdj
(or the opposite adjEntry of the dual edge if reverse
is set).
Definition at line 490 of file DualGraph.h.
Returns the edge in the dual graph corresponding to e
.
e | is an edge in the primal graph |
Definition at line 177 of file DualGraph.h.
Returns the face in the embedding of the dual graph corresponding to v
.
v | is a node in the primal graph |
Definition at line 184 of file DualGraph.h.
Returns the node in the dual graph corresponding to f
.
f | is a face in the embedding of the primal graph |
Definition at line 170 of file DualGraph.h.
|
inline |
Returns a reference to the combinatorial embedding of the primal graph.
Definition at line 136 of file DualGraph.h.
|
inline |
Returns a reference to the primal graph.
Definition at line 139 of file DualGraph.h.
|
inline |
Removes edge e
and joins the two faces adjacent to e
.
e | is an edge in the associated graph. |
Definition at line 353 of file DualGraph.h.
|
inline |
Returns the edge in the primal graph corresponding to e
.
e | is an edge in the dual graph |
Definition at line 156 of file DualGraph.h.
|
inline |
Returns the face in the embedding of the primal graph corresponding to v
.
v | is a node in the dual graph |
Definition at line 163 of file DualGraph.h.
|
inline |
Returns the node in the primal graph corresponding to f
.
f | is a face in the embedding of the dual graph |
Definition at line 149 of file DualGraph.h.
|
inline |
Removes degree-1 node v
.
Definition at line 372 of file DualGraph.h.
|
inline |
Reverses edges e
and updates embedding.
Definition at line 397 of file DualGraph.h.
|
inline |
Splits a face by inserting a new edge.
Creates a new edge from the node of adjSrc
to the one of adjTgt
. Note that this can also be achieved by inserting an edge in the underlying graph directly and calling computeFaces again. In contrast, this operation achieves constant running time.
adjSrc
and adjTgt
belong to the same face.adjSrc | The adjEntry after which the source adjEntry of the new edge should be inserted. |
adjTgt | The adjEntry after which the target adjEntry of the new edge should be inserted. |
sourceAfter | Only has an effect if adjSrc == adjTgt . Marks whether the source of the introduced self-loop comes after its target in the adjacency list. |
Definition at line 303 of file DualGraph.h.
|
inline |
Splits a node while preserving the order of adjacency entries.
This method splits a node v into two nodes vl and vr. Node vl receives all adjacent edges of v from adjStartLeft
until the edge preceding adjStartRight
, and vr the remaining nodes (thus adjStartRight
is the first edge that goes to vr). The order of adjacency entries is preserved. Additionally, a new edge (vl,vr) is created, such that this edge is inserted before adjStartLeft
and adjStartRight
in the the adjacency lists of vl and vr.
Node v is modified to become node vl, and node vr is returned.
adjStartLeft | is the first entry that goes to the left node. |
adjStartRight | is the first entry that goes to the right node. |
Definition at line 246 of file DualGraph.h.
|
inline |
Splits edge e=
(v,w) into e=(v,u) and e'=(u,w) creating a new node u.
e | is the edge to be split; e is modified by the split. |
Definition at line 192 of file DualGraph.h.
|
inline |
Undoes a split operation.
eIn | is the edge (v,u). |
eOut | is the edge (u,w). |
Definition at line 228 of file DualGraph.h.
|
protected |
The corresponding edge in the dual graph.
Definition at line 440 of file DualGraph.h.
|
protected |
The corresponding face in embedding of the dual graph.
Definition at line 439 of file DualGraph.h.
|
protected |
The corresponding node in the dual graph.
Definition at line 438 of file DualGraph.h.
|
protected |
The corresponding edge in the primal graph.
Definition at line 437 of file DualGraph.h.
|
protected |
The embedding of the primal graph.
Definition at line 434 of file DualGraph.h.
|
protected |
The corresponding facee in the embedding of the primal graph.
Definition at line 436 of file DualGraph.h.
|
protected |
The corresponding node in the primal graph.
Definition at line 435 of file DualGraph.h.