40#include <ogdf/basic/internal/config_autogen.h>
134 : m_id(id), m_size(0), m_pEmbedding(pEmbedding), entries(adjFirst) { }
151 int size()
const {
return m_size; }
162 return (adj != entries.
m_adjFirst) ? adj :
nullptr;
180template<
class Value,
bool WithDefault>
191#define OGDF_DECL_REG_ARRAY_TYPE(v, c) FaceArrayBase<v, c>
193#undef OGDF_DECL_REG_ARRAY_TYPE
252 bool valid()
const {
return m_cpGraph !=
nullptr; }
264 operator const Graph&()
const {
return getGraph(); }
297 std::function<
bool(
face)> includeFace = [](
face) {
return true; },
298 bool isFastTest =
true)
const;
339 if (key ==
nullptr) {
344 OGDF_ASSERT(keyToIndex(key) < this->getArraySize());
373 return findCommonFace(v, w, adj, left);
448 operator const Graph&()
const {
return getGraph(); }
450 operator Graph&() {
return getGraph(); }
465 ConstCombinatorialEmbedding::init(G);
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
#define OGDF_DECL_REG_ARRAY(NAME)
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 faceCycleSucc() const
Returns the cyclic successor in face.
Combinatorial embeddings of planar graphs with modification functionality.
void updateMerger(edge e, face fRight, face fLeft)
Update face information after inserting a merger in a copy graph.
node splitNode(adjEntry adjStartLeft, adjEntry adjStartRight)
Splits a node while preserving the order of adjacency entries.
void removeDeg1(node v)
Removes degree-1 node v.
CombinatorialEmbedding()
Creates a combinatorial embedding associated with no graph.
void init(Graph &G)
Initializes the embedding for graph G.
Graph * m_pGraph
The associated graph.
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.
CombinatorialEmbedding(const CombinatorialEmbedding &)=delete
void moveBridge(adjEntry adjBridge, adjEntry adjBefore)
Moves a bridge in the graph.
void reverseEdge(edge e)
Reverses edges e and updates embedding.
face joinFaces(adjEntry adj)
Removes edge e corresponding to adj and joins the two faces adjacent to e.
CombinatorialEmbedding & operator=(const CombinatorialEmbedding &)=delete
CombinatorialEmbedding(Graph &G)
Creates a combinatorial embedding of graph G.
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.
edge split(edge e)
Splits edge e=(v,w) into e=(v,u) and e'=(u,w) creating a new node u.
void clear()
Removes all nodes, edges, and faces from the graph and the embedding.
edge addEdgeToIsolatedNode(adjEntry adj, node v, bool adjSrc)
Inserts a new edge similarly to splitFace without having to call computeFaces again.
const Graph & getGraph() const
Returns the associated graph.
void unsplit(edge eIn, edge eOut)
Undoes a split operation.
edge splitFace(adjEntry adjSrc, adjEntry adjTgt, bool sourceAfter=false)
Splits a face by inserting a new edge.
Combinatorial embeddings of planar graphs.
int calculateArraySize(int add) const
const Graph * m_cpGraph
The associated graph.
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.
face rightFace(adjEntry adj) const
Returns the face to the right of adj, i.e., the face containing adj.
bool isBridge(edge e) const
ConstCombinatorialEmbedding(const Graph &G)
Creates a combinatorial embedding of graph G.
face chooseFace(std::function< bool(face)> includeFace=[](face) { return true;}, bool isFastTest=true) const
Returns a random face.
static int keyToIndex(face key)
face firstFace() const
Returns the first face in the list of all faces.
bool isKeyAssociated(face key) const
face_iterator begin() const
face maximalFace() const
Returns a face of maximal size.
face_iterator end() const
bool valid() const
Returns whether the embedding is associated with a graph.
face externalFace() const
Returns the external face.
void computeFaces()
Computes the list of faces.
face createFaceElement(adjEntry adjFirst)
Create a new face.
virtual ~ConstCombinatorialEmbedding()
Destructor.
void init(const Graph &G)
Initializes the embedding for graph G.
face lastFace() const
Returns the last face in the list of all faces.
int maxFaceIndex() const
Returns the largest used face index.
void setExternalFace(face f)
Sets the external face to f.
const Graph & getGraph() const
Returns the associated graph of the combinatorial embedding.
ConstCombinatorialEmbedding()
Creates a combinatorial embedding associated with no graph.
face leftFace(adjEntry adj) const
Returns the face to the left of adj, i.e., the face containing the twin of adj.
ConstCombinatorialEmbedding(const ConstCombinatorialEmbedding &C)
Copy constructor.
void consistencyCheck() const
Asserts that this embedding is consistent.
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.
AdjEntryArray< face > m_rightFace
The face to which an adjacency entry belongs.
int m_faceIdCount
The index assigned to the next created face.
int numberOfFaces() const
Returns the number of faces.
internal::GraphObjectContainer< FaceElement > faces
The container containing all face objects.
ConstCombinatorialEmbedding & operator=(const ConstCombinatorialEmbedding &C)
Assignment operator.
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.
RegisteredArray for labeling the faces of a CombinatorialEmbedding.
ConstCombinatorialEmbedding * embeddingOf() const
Returns a pointer to the associated combinatorial embedding.
Faces in a combinatorial embedding.
face pred() const
Returns the predecessor in the list of all faces.
int size() const
Returns the size of the face, i.e., the number of edges in the face.
FaceElement(const ConstCombinatorialEmbedding *pEmbedding, adjEntry adjFirst, int id)
Creates a face with given first adjacency element adjFirst, face index id and keeps track of the owne...
static int compare(const FaceElement &x, const FaceElement &y)
Standard Comparer.
int m_size
The size of the face.
adjEntry nextFaceEdge(adjEntry adj) const
Returns the successor of adj in the list of all adjacency elements in the face.
const ConstCombinatorialEmbedding * embeddingOf() const
face succ() const
Returns the successor in the list of all faces.
internal::FaceAdjContainer entries
Container maintaining the adjacency entries in the face.
adjEntry firstAdj() const
Returns the first adjacency element in the face.
const ConstCombinatorialEmbedding * m_pEmbedding
int index() const
Returns the index of the face.
int m_id
The index of the face.
Copies of graphs supporting edge splitting.
Data type for general directed graphs (adjacency list representation).
Class for the representation of nodes.
Dynamic arrays indexed with arbitrary keys.
typename std::conditional< WithDefault, internal::RegisteredArrayWithDefault< ConstCombinatorialEmbedding, Value >, internal::RegisteredArrayWithoutDefault< ConstCombinatorialEmbedding, Value > >::type RA
Abstract base class for registries.
Container for the adjacency entries in a face.
FaceAdjContainer(adjEntry adjFirst)
Forward iterator for adjacency entries in a face.
bool operator!=(const FaceAdjIterator &other) const
FaceAdjIterator & operator=(const FaceAdjIterator &)=default
bool operator==(const FaceAdjIterator &other) const
FaceAdjIterator & operator++()
FaceAdjIterator(const FaceAdjIterator &)=default
FaceAdjIterator(adjEntry adj)
FaceAdjIterator(adjEntry adjFirst, adjEntry adj)
adjEntry operator*() const
The base class for objects used by (hyper)graphs.
Lists of graph objects (like nodes, edges, etc.).
T * head() const
Returns the first element in the list.
T * tail() const
Returns the last element in the list.
iterator begin() const
Returns an iterator to the first element in the container.
iterator end() const
Returns an iterator to the one-past-last element in the container.
int size() const
Returns the size of the list.
Public read-only interface for lists of graph objects.
RegisteredArray for nodes, edges and adjEntries of a graph.
Declarations for Comparer objects.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Decralation of graph iterators.
#define OGDF_AUGMENT_COMPARER(type)
Add this macro to your class to turn it into a full comparer.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Declaration of memory manager for allocating small pieces of memory.
The namespace for all OGDF objects.
std::ostream & operator<<(std::ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
int calculateTableSize(int actualCount)
The default growth function for registered arrays.