 |
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
82 #if __cpp_concepts >= 201907
86 { f(
node()) } -> std::convertible_to<bool>;
90 { f(
edge()) } -> std::convertible_to<bool>;
93 concept
OGDF_NODE_ITER = std::forward_iterator<T> && requires(T i) {
94 { *i } -> std::convertible_to<node>;
97 concept
OGDF_EDGE_ITER = std::forward_iterator<T> && requires(T i) {
98 { *i } -> std::convertible_to<edge>;
114 # define OGDF_HAS_CONCEPTS
115 # define OGDF_CHECK_CONCEPT static_assert
128 # define OGDF_NODE_FILTER typename
129 # define OGDF_EDGE_FILTER typename
130 # define OGDF_NODE_ITER typename
131 # define OGDF_EDGE_ITER typename
132 # define OGDF_NODE_LIST typename
133 # define OGDF_EDGE_LIST typename
135 # define OGDF_CHECK_CONCEPT(...)
154 explicit AdjElement(
node v) : m_twin(nullptr), m_edge(nullptr), m_node(v), m_id(0) { }
157 AdjElement(
edge e,
int id) : m_twin(nullptr), m_edge(e), m_node(nullptr), m_id(id) { }
164 operator edge()
const {
return m_edge; }
170 operator node()
const {
return m_node; }
182 bool isSource()
const;
230 const Graph* graphOf()
const;
264 : m_indeg(0), m_outdeg(0), m_id(id), m_pGraph(pGraph) { }
266 NodeElement(
int id) : m_indeg(0), m_outdeg(0), m_id(id) { }
278 int indeg()
const {
return m_indeg; }
284 int degree()
const {
return m_indeg + m_outdeg; }
303 template<
class ADJLIST>
306 for (
adjEntry adj : this->adjEntries) {
307 adjList.pushBack(adj);
319 template<
class EDGELIST>
322 for (
adjEntry adj : this->adjEntries) {
323 edgeList.pushBack(adj->theEdge());
332 template<
class EDGELIST>
333 void inEdges(EDGELIST& edgeList)
const;
340 template<
class EDGELIST>
341 void outEdges(EDGELIST& edgeList)
const;
344 const Graph* graphOf()
const {
return m_pGraph; }
383 : m_src(src), m_tgt(tgt), m_adjSrc(adjSrc), m_adjTgt(adjTgt), m_id(id) { }
392 : m_src(src), m_tgt(tgt), m_adjSrc(nullptr), m_adjTgt(nullptr), m_id(id) { }
405 std::array<node, 2>
nodes()
const {
return std::array<node, 2> {{m_src, m_tgt}}; }
416 return v == m_src ? m_tgt : m_src;
430 return isParallelDirected(e) || isInvertedDirected(e);
440 const Graph* graphOf()
const {
return m_src->
graphOf(); }
452 return (m_src == e->
m_src || m_src == e->
m_tgt)
454 : ((m_tgt == e->
m_src || m_tgt == e->
m_tgt) ? m_tgt :
nullptr);
461 return v == m_src ? m_adjSrc : m_adjTgt;
472 bool m_hidden =
false;
488 bool result =
this != adjBefore &&
this != adjAfter && adjBefore != adjAfter;
492 for (; adj !=
this && adj != adjAfter; adj = adj->
cyclicSucc()) {
495 result = adj ==
this;
501 template<
class EDGELIST>
505 edge e = adj->theEdge();
507 edgeList.pushBack(e);
512 template<
class EDGELIST>
516 edge e = adj->theEdge();
518 edgeList.pushBack(e);
597 template<
typename Key,
typename Iterable = GraphObjectContainer<Key>,
int Factor = 1>
599 :
public RegistryBase<Key*, GraphRegistry<Key, Iterable, Factor>, typename Iterable::iterator> {
610 static inline int keyToIndex(Key* key) {
return key->index(); }
613 if (key ==
nullptr) {
642 #ifndef DOXYGEN_IGNORE
658 template<
typename Key,
typename Value,
bool WithDefault,
typename Registry = GraphRegistry<Key>>
667 if (RA::registeredAt() ==
nullptr) {
670 return RA::registeredAt()->graphOf();
676 template<
typename Value,
bool WithDefault>
683 using GRA::operator[];
684 using GRA::operator();
690 return GRA::operator[](adj->
index() >> 1);
697 return GRA::operator[](adj->
index() >> 1);
704 return GRA::operator[](adj->
index() >> 1);
711 return GRA::operator[](adj->
index() >> 1);
716 template<
typename Value,
bool WithDefault>
722 template<
bool WithDefault>
739 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) internal::GraphRegisteredArray<NodeElement, v, c>
742 #undef OGDF_DECL_REG_ARRAY_TYPE
744 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) internal::EdgeArrayBase2<v, c>
747 #undef OGDF_DECL_REG_ARRAY_TYPE
749 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) \
750 internal::GraphRegisteredArray<AdjElement, v, c, internal::GraphAdjRegistry>
753 #undef OGDF_DECL_REG_ARRAY_TYPE
780 OGDF_DEPRECATED(
"calls registrationChanged with only partially-constructed child classes, "
781 "see copy constructor of Observer for fix")
786 virtual void nodeDeleted(
node v) = 0;
789 virtual void nodeAdded(
node v) = 0;
792 virtual void edgeDeleted(
edge e) = 0;
795 virtual void edgeAdded(
edge e) = 0;
798 virtual void cleared() = 0;
804 template<
typename CONTAINER>
805 inline void getAllNodes(
const Graph& G, CONTAINER& nodes);
806 template<
typename CONTAINER>
807 inline void getAllEdges(
const Graph& G, CONTAINER& edges);
906 enum class EdgeType { association = 0, generalization = 1, dependency = 2 };
912 generalizationMerger = 2,
913 generalizationExpander = 3,
914 highDegreeExpander = 4,
915 lowDegreeExpander = 5,
1013 std::function<
bool(
node)> includeNode = [](
node) {
return true; },
1014 bool isFastTest =
true)
const;
1024 std::function<
bool(
edge)> includeEdge = [](
edge) {
return true; },
1025 bool isFastTest =
true)
const;
1032 template<
class CONTAINER>
1034 internal::getAllNodes<CONTAINER>(*
this, nodeContainer);
1042 template<
class CONTAINER>
1044 internal::getAllEdges<CONTAINER>(*
this, edgeContainer);
1062 node v = pureNewNode(index);
1142 return newEdge(adjSrc, dir, adjTgt, dir, index);
1164 template<
typename S,
typename T>
1170 insertAdjEntry(tgt, e->
m_adjTgt, dirTgt);
1171 insertAdjEntry(src, e->
m_adjSrc, dirSrc);
1190 virtual void delNode(
node v);
1193 virtual void delEdge(
edge e);
1196 virtual void clear();
1199 void restoreAllEdges();
1233 m_it = m_graph->m_hiddenEdgeSets.pushFront(
this);
1242 m_graph->m_hiddenEdgeSets.del(m_it);
1260 void restore(
edge e);
1317 void unsplit(
node u);
1331 virtual void unsplit(
edge eIn,
edge eOut);
1366 node contract(
edge e,
bool keepSelfLoops =
false);
1434 edge searchEdge(
node v,
node w,
bool directed =
false)
const;
1437 void reverseEdge(
edge e);
1440 void reverseAllEdges();
1449 template<
class NODELIST>
1451 node v = nodesToCollapse.popFrontRet();
1452 while (!nodesToCollapse.empty()) {
1453 node w = nodesToCollapse.popFrontRet();
1455 while (adj !=
nullptr) {
1460 }
else if (e->
source() == w) {
1479 template<
class ADJ_ENTRY_LIST>
1498 std::set<int> entries;
1501 for (
auto it =
begin; it !=
end; ++it) {
1503 entries.insert(adj->
index());
1534 adjList.
move(adjMove, adjList, adjPos, dir);
1568 void reverseAdjEdges();
1610 void consistencyCheck()
const;
1672 void resetEdgeIdCount(
int maxId);
1674 void resetNodeIdCount(
int maxId);
1717 bool notifyObservers =
true>
1718 std::pair<int, int> insert(
const NI& nodesBegin,
const NI& nodesEnd,
const EI& edgesBegin,
1748 template<OGDF_NODE_ITER NI, OGDF_EDGE_FILTER EF,
bool copyIDs = false,
bool notifyObservers = true>
1749 std::pair<int, int> insert(
const NI& nodesBegin,
const NI& nodesEnd,
const EF& edgeFilter,
1760 template<OGDF_NODE_LIST NL>
1770 template<OGDF_NODE_LIST NL, OGDF_EDGE_LIST EL>
1778 return insert(
begin(nodeList),
end(nodeList),
begin(edgeList),
end(edgeList), nodeMap,
1811 if (!nodeMap.registeredAt()) {
1815 if (!edgeMap.registeredAt()) {
1822 auto count = insert(G.nodes.begin(), G.nodes.end(),
filter_any_edge, nodeMap, edgeMap);
1837 return insert(G, nodeMap, edgeMap);
1841 template<OGDF_NODE_ITER NI,
bool notifyObservers,
bool copyIDs>
1843 int& newNodes,
void* cbData);
1891 virtual void postInsert(
void* userData,
int newNodes,
int newEdges) {};
1928 int stopNode(
int cc)
const {
return m_startNode[cc + 1]; }
1931 return {m_nodes.
begin() + startNode(cc), m_nodes.
begin() + stopNode(cc)};
1935 return {m_edges.
begin() + startEdge(cc), m_edges.
begin() + stopEdge(cc)};
1942 int stopEdge(
int cc)
const {
return m_startEdge[cc + 1]; }
1945 node v(
int i)
const {
return m_nodes[i]; }
1948 edge e(
int i)
const {
return m_edges[i]; }
1961 index = m_nodeIdCount++;
1963 m_nodeIdCount = max(m_nodeIdCount, index + 1);
1997 index = m_edgeIdCount++;
1999 m_edgeIdCount = max(m_edgeIdCount, index + 1);
2059 namespace internal {
2061 template<
typename CONTAINER>
2064 for (
node v : G.nodes) {
2071 nodes.
init(G.numberOfNodes());
2073 for (
node v : G.nodes) {
2078 template<
typename CONTAINER>
2081 for (
edge v : G.edges) {
2088 edges.
init(G.numberOfEdges());
2090 for (
edge v : G.edges) {
Value & operator()(adjEntry adj)
Returns a reference to the element associated with the edge corresponding to adj.
#define OGDF_COPY_CONSTR(cls)
Declares the copy constructor for class cls.
Abstract base class for registries.
The namespace for all OGDF objects.
Dynamic arrays indexed with arbitrary keys.
#define OGDF_DECL_REG_ARRAY(NAME)
int size() const
Returns the size of the list.
List< HiddenEdgeSet * > m_hiddenEdgeSets
The list of hidden edges.
bool empty() const
Returns true iff the graph is empty, i.e., contains no nodes.
int numberOfEdges(int cc) const
Returns the number of edges in connected component cc.
internal::GraphAdjRegistry & adjEntryRegistry()
Returns a reference to the registry of adjEntry arrays associated with this graph.
void sort(node v, const ADJ_ENTRY_LIST &newOrder)
Sorts the adjacency list of node v according to newOrder.
std::pair< int, int > insert(const Graph &G)
Inserts a copy of a given Graph G into this graph.
node pureNewNode(int index)
Creates a new node object with id index and adds it to the list of nodes.
const Graph * getGraph() const
Info structure for maintaining connected components.
adjEntry pred() const
Returns the predecessor in the adjacency list.
edge pureNewEdge(node src, node tgt, int index)
Creates a new edge object with id index and corresponding AdjElements and adds it to the list of edge...
Graph * graphOf() const
Returns a pointer to the associated graph.
GraphObject * tail() const
Returns the last element in the list.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static void insertAdjEntry(node n, adjEntry newAdj, Direction dir)
bool operator!=(const GraphAdjIterator &iter) const
Inequality operator.
internal::SimpleRange< Array< node >::const_iterator > nodes(int cc) const
internal::GraphEdgeRegistry & edgeRegistry()
Returns a reference to the registry of edge arrays associated with this graph.
edge e(int i) const
Returns the edge with index i.
node theNode() const
Returns the node whose adjacency list contains this element.
int m_indeg
The indegree of the node.
int maxEdgeIndex() const
Returns the largest used edge index.
bool isParallelUndirected(edge e) const
Returns true iff edge e is parallel to this (undirected) edge (or if it is the same edge)
int stopEdge(int cc) const
Returns the index of (one past) the last edge in connected component cc.
Utility macros for declaring copy and move constructors and assignment operations.
void getAllEdges(const Graph &G, CONTAINER &edges)
#define OGDF_DEPRECATED(reason)
Mark a class / member / function as deprecated.
HiddenEdgeSet(Graph &graph)
Creates a new set of hidden edges.
GraphRegistry(Graph *graph, int *nextKeyIndex)
Constructor.
adjEntry counterClockwiseFaceSucc() const
Returns the counter-clockwise successor in face.
EdgeType
The type of edges (only used in derived classes).
typename std::conditional< WithDefault, internal::RegisteredArrayWithDefault< Registry, Value >, internal::RegisteredArrayWithoutDefault< Registry, Value > >::type RA
void swapAdjEdges(adjEntry adj1, adjEntry adj2)
Exchanges two entries in an adjacency list.
HypergraphRegistry< HypernodeElement >::iterator begin(const HypergraphRegistry< HypernodeElement > &self)
Array< int > m_startNode
start node of each connected component in m_nodes.
adjEntry lastAdj() const
Returns the last entry in the adjacency list.
Functionality for temporarily hiding edges in constant time.
int index() const
Returns the (unique) node index.
const Graph & constGraph() const
Returns the associated graph.
void getAllNodes(const Graph &G, CONTAINER &nodes)
GraphElement * m_next
The successor in the list.
adjEntry cyclicPred() const
Returns the cyclic predecessor in the adjacency list.
The base class for objects used by (hyper)graphs.
internal::EdgeArrayBase2< Value, WithDefault > EdgeArray
RegisteredArray for labeling the edges in a Graph with an arbitrary Value.
const internal::GraphAdjRegistry & adjEntryRegistry() const
Returns a const reference to the registry of adjEntry arrays associated with this graph.
void moveAdjBefore(adjEntry adjMove, adjEntry adjBefore)
Moves adjacency entry adjMove before adjBefore.
void allNodes(CONTAINER &nodeContainer) const
Returns a container with all nodes of the graph.
Simple, safe base classes for C++ observables and observers.
bool isParallelDirected(edge e) const
Returns true iff edge e is parallel to this (directed) edge (or if it is the same edge)
bool operator==(const Tuple2< E1, E2 > &t1, const Tuple2< E1, E2 > &t2)
Equality operator for 2-tuples.
std::pair< node, node > split(Graph &G, sync_plan::PipeBij &bij, const EdgeArray< edge > *new_edges=nullptr, const EdgeArray< bool > *reverse_edges=nullptr, node src=nullptr, node tgt=nullptr)
void moveAdjAfter(adjEntry adjMove, adjEntry adjAfter)
Moves adjacency entry adjMove after adjAfter.
internal::GraphEdgeRegistry m_regEdgeArrays
The registered edge arrays.
GraphAdjIterator operator--(int)
Decrement operator (postfix).
bool isInvertedDirected(edge e) const
Returns true iff edge e is an inverted edge to this (directed) edge.
Graph * graphOf() const
Returns a pointer to the associated graph.
const internal::GraphNodeRegistry & nodeRegistry() const
Returns a const reference to the registry of node arrays associated with this graph.
int index() const
Returns the index of the edge.
Iterator for AdjEntries of a graph.
Array< int > m_startEdge
start edge of each connected component in m_edges.
bool filter_any_edge(edge e)
std::function<bool(edge)> that returns true for any edge e
void inEdges(EDGELIST &edgeList) const
Returns a list with all incoming edges of this node.
std::pair< int, int > insert(const Graph &G, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
Inserts a copy of a given Graph G into this graph.
#define OGDF_CHECK_CONCEPT(...)
void sort(node v, IT begin, IT end)
Sorts the adjacency list of node v according to the range denoted by two iterators.
#define OGDF_AUGMENT_STATICCOMPARER(type)
Add this macro to your class to turn it into a full static comparer.
int getBucket(const edge &e) override
Returns source index of e.
Abstract base class for bucket functions.
node pred() const
Returns the predecessor in the list of all nodes.
node m_src
The source node of the edge.
#define OGDF_NO_MOVE(cls)
Explicitly disables (deletes) move construction and assignment for class cls.
adjEntry mapEndpoint(adjEntry adj) const
Map a source/target adjEntry to the source/target adjEntry of the corresponding edges.
int m_numCC
the number of connected components.
Public read-only interface for lists of graph objects.
const Graph * graphOf() const
GraphAdjIterator operator++(int)
Increment operator (postfix).
virtual void postInsert(void *userData, int newNodes, int newEdges)
Callback notifying subclasses that an insert() call has finished.
void init()
Reinitializes the array to an array with empty index set.
void allEdges(CONTAINER &edgeContainer) const
Returns a container with all edges of the graph.
adjEntry twin() const
Returns the corresponding adjacency element associated with the same edge.
internal::GraphRegisteredArray< NodeElement, Value, WithDefault > NodeArray
RegisteredArray for labeling the nodes in a Graph with an arbitrary Value.
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
void move(T *pX, GraphList< T > &L, T *pY, Direction dir)
Moves element pX to list L and inserts it before or after pY.
ListIterator< HiddenEdgeSet * > m_it
GraphAdjIterator end()
Returns an iterator to the one-past-last adjEntry in the associated graph.
const internal::GraphEdgeRegistry & edgeRegistry() const
Returns a const reference to the registry of edge arrays associated with this graph.
edge m_edge
The associated edge.
EdgeElement(node src, node tgt, int id)
Constructs an edge element (src,tgt).
internal::SimpleRange< Array< edge >::const_iterator > edges(int cc) const
virtual void nodeInserted(void *userData, node original, node copy)
Callback notifying subclasses that insert() copied a node.
int m_outdeg
The outdegree of the node.
std::pair< int, int > insert(const CCsInfo &info, int cc, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
Inserts a copy of a given connected component cc into this graph.
AdjElement * adjEntry
The type of adjacency entries.
node v(int i) const
Returns the node with index i.
bool filter_any_node(node n)
std::function<bool(node)> that returns true for any node n
adjEntry faceCyclePred() const
Returns the cyclic predecessor in face.
static int keyToIndex(Key *key)
CCsInfo()
Creates a info structure associated with no graph.
static void insertAdjEntry(adjEntry oldAdj, adjEntry newAdj, Direction dir)
Class for adjacency list elements.
const Graph * m_pGraph
The graph containg this node (debug only).
Implementation of the ogdf::Graph::insert(...) template methods.
bool isSource() const
Returns true iff this is the source adjacency entry of the corresponding edge.
edge newEdge(adjEntry adjSrc, node w, int index=-1)
Creates a new edge at predefined positions in the adjacency lists.
static int compare(const NodeElement &x, const NodeElement &y)
Standard Comparer.
internal::GraphNodeRegistry & nodeRegistry()
Returns a reference to the registry of node arrays associated with this graph.
adjEntry clockwiseFacePred() const
Returns the clockwise predecessor in face. Use faceCycleSucc instead!
EdgeElement * edge
The type of edges.
void sort(T *array, int size, LessThan lt)
edge theEdge() const
Returns the edge associated with this adjacency entry.
Base class for an observable object that can be tracked by multiple Observer objects.
AdjElement * m_adjTgt
Corresponding adjacency entry at target node.
GraphAdjIterator & operator--()
Decrement operator (prefix).
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
static void copy(const T &from, T &to)
bool isSelfLoop() const
Returns true iff the edge is a self-loop (source node = target node).
void reverseAdjEdges(node v)
Reverses the adjacency list of v.
int numberOfEdges() const
Returns the number of edges in the graph.
int outdeg() const
Returns the outdegree of the node.
int getBucket(const edge &e) override
Returns target index of e.
int degree() const
Returns the degree of the node (indegree + outdegree).
adjEntry clockwiseFaceSucc() const
Returns the clockwise successor in face. Use faceCycleSucc instead!
int m_edgeIdCount
The Index that will be assigned to the next created edge.
#define OGDF_MALLOC_NEW_DELETE
Makes the class use malloc for memory allocation.
node adjToNode(adjEntry adj)
int stopNode(int cc) const
Returns the index of (one past) the last node in connected component cc.
int numberOfNodes() const
Returns the number of nodes in the graph.
AdjElement(node v)
Constructs an adjacency element for a given node.
internal::GraphRegisteredArray< AdjElement, Value, WithDefault, internal::GraphAdjRegistry > AdjEntryArray
RegisteredArray for labeling the adjEntries in a Graph with an arbitrary Value.
const T & move(const T &v)
Decralation of GraphElement and GraphList classes.
adjEntry succ() const
Returns the successor in the adjacency list.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
int calculateTableSize(int actualCount)
The default growth function for registered arrays.
void pushBack(GraphObject *pX)
Adds element pX at the end of the list.
int indeg() const
Returns the indegree of the node.
Declaration and implementation of RegisteredArray class.
edge newEdge(S src, Direction dirSrc, T tgt, Direction dirTgt, int index=-1)
Creates a new edge at predefined positions in the adjacency lists.
Bucket function using the index of an edge's source node as bucket.
internal::GraphList< EdgeElement > m_edges
node firstNode() const
Returns the first node in the list of all nodes.
~HiddenEdgeSet()
Restores all hidden edges.
#define OGDF_NO_COPY(cls)
Explicitly disables (deletes) copy construction and assignment for class cls.
bool isBetween(adjEntry adjBefore, adjEntry adjAfter) const
Returns whether this adjacency entry lies between adjBefore and adjAfter in clockwise rotation.
bool isKeyAssociated(Key *key) const
int maxNodeIndex() const
Returns the largest used node index.
edge pred() const
Returns the predecessor in the list of all edges.
std::ostream & operator<<(std::ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
Bucket function using the index of an edge's target node as bucket.
iterator begin()
Returns an iterator to the first element.
node source() const
Returns the source node of the edge.
NodeElement * node
The type of nodes.
Abstract Base class for graph observers.
Doubly linked lists (maintaining the length of the list).
RegisteredArray for nodes, edges and adjEntries of a graph.
void keyAdded(Key key)
Records the addition of a new key and resizes all registered arrays if necessary.
adjEntry adjSource() const
Returns the corresponding adjacancy entry at source node.
Base class for GraphElement lists.
Data type for general directed graphs (adjacency list representation).
const Value & operator[](adjEntry adj) const
Returns a const reference to the element associated with the edge corresponding to adj.
Lists of graph objects (like nodes, edges, etc.).
virtual void * preInsert(bool copyEmbedding, bool copyIDs, bool notifyObservers, bool edgeFilter, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap, int *newNodes, int *newEdges)
Callback notifying subclasses that some graph is about to be insert() -ed.
int numberOfNodes(int cc) const
Returns the number of nodes in connected component cc.
node lastNode() const
Returns the last node in the list of all nodes.
int m_id
The (unique) index of the adjacency entry.
NodeType
The type of nodes.
#define OGDF_COPY_OP(cls)
Declares the copy assignment operation for class cls. Don't forget to return *this;.
edge lastEdge() const
Returns the last edge in the list of all edges.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Decralation of graph iterators.
adjEntry getAdj(node v) const
Returns an adjacency entry of this edge at node v. If this is a self-loop the source adjacency entry ...
adjEntry cyclicSucc() const
Returns the cyclic successor in the adjacency list.
AdjElement * m_twin
The corresponding adjacency entry (same edge)
bool empty() const
Returns true iff the list is empty.
int m_nodeIdCount
The Index that will be assigned to the next created node.
adjEntry adjTarget() const
Returns the corresponding adjacancy entry at target node.
AdjElement * m_adjSrc
Corresponding adjacency entry at source node.
bool representsCombEmbedding() const
Returns true iff the graph represents a combinatorial embedding.
void allAdjEntries(ADJLIST &adjList) const
Returns a list with all adjacency entries of this node.
NodePair(node src, node tgt)
void adjEdges(EDGELIST &edgeList) const
Returns a list with all edges incident to this node.
edge newEdge(adjEntry adjSrc, adjEntry adjTgt, Direction dir=Direction::after, int index=-1)
Creates a new edge at predefined positions in the adjacency lists.
GraphObject * head() const
Returns the first element in the list.
Base class for an observer for a single Observable object.
edge firstEdge() const
Returns the first edge in the list of all edges.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
GraphElement * m_prev
The predecessor in the list.
bool operator==(const GraphAdjIterator &iter) const
Equality operator.
static int compare(const AdjElement &x, const AdjElement &y)
Standard Comparer.
Basic declarations, included by all source files.
AdjElement & operator->() const
Returns a reference to the associated adjElement.
HypergraphRegistry< HypernodeElement >::iterator end(const HypergraphRegistry< HypernodeElement > &self)
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
RegisteredArray for edges of a graph.
static int compare(const EdgeElement &x, const EdgeElement &y)
Standard Comparer.
node newNode(int index=-1)
Creates a new node and returns it.
adjEntry firstAdj() const
Returns the first entry in the adjaceny list.
node succ() const
Returns the successor in the list of all nodes.
adjEntry faceCycleSucc() const
Returns the cyclic successor in face.
Declaration and implementation of Array class and Array algorithms.
node m_tgt
The target node of the edge.
internal::GraphNodeRegistry m_regNodeArrays
The registered node arrays.
node opposite(node v) const
Returns the adjacent node different from v.
int startNode(int cc) const
Returns the index of the first node in connected component cc.
Class for the representation of edges.
Value & operator[](adjEntry adj)
Returns a reference to the element associated with the edge corresponding to adj.
void moveAdj(adjEntry adjMove, Direction dir, adjEntry adjPos)
Moves adjacency entry adjMove before or after adjPos.
const Graph * m_graph
points to the associated graph.
Declaration of doubly linked lists and iterators.
edge succ() const
Returns the successor in the list of all edges.
const Graph * graphOf() const
Returns the graph containing this node (debug only).
Array< node > m_nodes
array of all nodes.
Array< edge > m_edges
array of all edges.
AdjElement(edge e, int id)
Constructs an adjacency entry for a given edge and index.
void init(const Graph *base=nullptr)
Reinitializes the array. Associates the array with the matching registry of base.
bool isIncident(node v) const
Returns true iff v is incident to the edge.
node m_node
The node whose adjacency list contains this entry.
edge newEdge(node v, adjEntry adjTgt, int index=-1)
Creates a new edge at predefined positions in the adjacency lists.
int maxAdjEntryIndex() const
Returns the largest used adjEntry index.
adjEntry counterClockwiseFacePred() const
Returns the counter-clockwise predecessor in face.
std::pair< int, int > insert(const NL &nodeList, const EL &edgeList, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
Inserts a copy of a given subgraph into this graph.
EdgeElement(node src, node tgt, AdjElement *adjSrc, AdjElement *adjTgt, int id)
Constructs an edge element (src,tgt).
Encapsulates a pointer to a list element.
int index() const
Returns the index of this adjacency element.
void outEdges(EDGELIST &edgeList) const
Returns a list with all outgoing edges of this node.
typename Iterable::iterator iterator
int getArraySize() const
Returns the current size of all registered arrays.
virtual void edgeInserted(void *userData, edge original, edge copy)
Callback notifying subclasses that insert() copied an edge.
const Value & operator()(adjEntry adj) const
Returns a const reference to the element associated with the edge corresponding to adj.
std::array< node, 2 > nodes() const
Returns a list of adjacent nodes. If this edge is a self-loop, both entries will be the same node.
node target() const
Returns the target node of the edge.
int numberOfCCs() const
Returns the number of connected components.
GraphAdjIterator & operator++()
Increment operator (prefix).
int m_id
The (unique) index of the node.
edge newEdge(node v, node w, int index=-1)
Creates a new edge (v,w) and returns it.
void copyEmbedding(const Graph &from, Graph &to, std::function< adjEntry(adjEntry)> adjMapFromTo)
Registry for nodes, edges and adjEntries of a graph.
Declarations for Comparer objects.
Class for the representation of nodes.
internal::GraphAdjRegistry m_regAdjArrays
The registered adjEntry arrays.
node commonNode(edge e) const
Returns the common node of the edge and e. Returns nullptr if the two edges are not adjacent.
adjEntry operator*() const
Returns the associated adjEntry.
Declaration of memory manager for allocating small pieces of memory.
bool isAdjacent(edge e) const
Returns true iff e is adjacent to the edge.
int calculateArraySize(int add) const
int startEdge(int cc) const
Returns the index of the first edge in connected component cc.
void collapse(NODELIST &nodesToCollapse)
Collapses all nodes in the list nodesToCollapse to the first node in the list.
NodeElement(const Graph *pGraph, int id)
Constructs a node element with index id.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
void reserveSpace(int new_keys)
Resizes all arrays to make space of new_keys new keys.