|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
81 #if __cpp_concepts >= 201907
85 { f(
node()) } -> std::convertible_to<bool>;
89 { f(
edge()) } -> std::convertible_to<bool>;
92 concept
OGDF_NODE_ITER = std::forward_iterator<T> && requires(T i) {
93 { *i } -> std::convertible_to<node>;
96 concept
OGDF_EDGE_ITER = std::forward_iterator<T> && requires(T i) {
97 { *i } -> std::convertible_to<edge>;
113 # define OGDF_HAS_CONCEPTS
114 # define OGDF_CHECK_CONCEPT static_assert
127 # define OGDF_NODE_FILTER typename
128 # define OGDF_EDGE_FILTER typename
129 # define OGDF_NODE_ITER typename
130 # define OGDF_EDGE_ITER typename
131 # define OGDF_NODE_LIST typename
132 # define OGDF_EDGE_LIST typename
134 # define OGDF_CHECK_CONCEPT(...)
153 explicit AdjElement(
node v) : m_twin(nullptr), m_edge(nullptr), m_node(v), m_id(0) { }
156 AdjElement(
edge e,
int id) : m_twin(nullptr), m_edge(e), m_node(nullptr), m_id(id) { }
163 operator edge()
const {
return m_edge; }
169 operator node()
const {
return m_node; }
181 bool isSource()
const;
229 const Graph* graphOf()
const;
263 : m_indeg(0), m_outdeg(0), m_id(id), m_pGraph(pGraph) { }
265 NodeElement(
int id) : m_indeg(0), m_outdeg(0), m_id(id) { }
277 int indeg()
const {
return m_indeg; }
283 int degree()
const {
return m_indeg + m_outdeg; }
302 template<
class ADJLIST>
305 for (
adjEntry adj : this->adjEntries) {
306 adjList.pushBack(adj);
318 template<
class EDGELIST>
321 for (
adjEntry adj : this->adjEntries) {
322 edgeList.pushBack(adj->theEdge());
331 template<
class EDGELIST>
332 void inEdges(EDGELIST& edgeList)
const;
339 template<
class EDGELIST>
340 void outEdges(EDGELIST& edgeList)
const;
343 const Graph* graphOf()
const {
return m_pGraph; }
382 : m_src(src), m_tgt(tgt), m_adjSrc(adjSrc), m_adjTgt(adjTgt), m_id(id) { }
391 : m_src(src), m_tgt(tgt), m_adjSrc(nullptr), m_adjTgt(nullptr), m_id(id) { }
404 std::array<node, 2>
nodes()
const {
return std::array<node, 2> {{m_src, m_tgt}}; }
415 return v == m_src ? m_tgt : m_src;
429 return isParallelDirected(e) || isInvertedDirected(e);
439 const Graph* graphOf()
const {
return m_src->
graphOf(); }
451 return (m_src == e->
m_src || m_src == e->
m_tgt)
453 : ((m_tgt == e->
m_src || m_tgt == e->
m_tgt) ? m_tgt :
nullptr);
460 return v == m_src ? m_adjSrc : m_adjTgt;
471 bool m_hidden =
false;
487 bool result =
this != adjBefore &&
this != adjAfter && adjBefore != adjAfter;
491 for (; adj !=
this && adj != adjAfter; adj = adj->
cyclicSucc()) {
494 result = adj ==
this;
500 template<
class EDGELIST>
504 edge e = adj->theEdge();
506 edgeList.pushBack(e);
511 template<
class EDGELIST>
515 edge e = adj->theEdge();
517 edgeList.pushBack(e);
596 template<
typename Key,
typename Iterable = GraphObjectContainer<Key>,
int Factor = 1>
598 :
public RegistryBase<Key*, GraphRegistry<Key, Iterable, Factor>, typename Iterable::iterator> {
609 static inline int keyToIndex(Key* key) {
return key->index(); }
612 if (key ==
nullptr) {
641 #ifndef DOXYGEN_IGNORE
657 template<
typename Key,
typename Value,
bool WithDefault,
typename Registry = GraphRegistry<Key>>
666 if (RA::registeredAt() ==
nullptr) {
669 return RA::registeredAt()->graphOf();
675 template<
typename Value,
bool WithDefault>
682 using GRA::operator[];
683 using GRA::operator();
689 return GRA::operator[](adj->
index() >> 1);
696 return GRA::operator[](adj->
index() >> 1);
703 return GRA::operator[](adj->
index() >> 1);
710 return GRA::operator[](adj->
index() >> 1);
715 template<
typename Value,
bool WithDefault>
721 template<
bool WithDefault>
738 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) internal::GraphRegisteredArray<NodeElement, v, c>
741 #undef OGDF_DECL_REG_ARRAY_TYPE
743 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) internal::EdgeArrayBase2<v, c>
746 #undef OGDF_DECL_REG_ARRAY_TYPE
748 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) \
749 internal::GraphRegisteredArray<AdjElement, v, c, internal::GraphAdjRegistry>
752 #undef OGDF_DECL_REG_ARRAY_TYPE
789 virtual void nodeDeleted(
node v) = 0;
792 virtual void nodeAdded(
node v) = 0;
795 virtual void edgeDeleted(
edge e) = 0;
798 virtual void edgeAdded(
edge e) = 0;
801 virtual void cleared() = 0;
807 template<
typename CONTAINER>
808 inline void getAllNodes(
const Graph& G, CONTAINER& nodes);
809 template<
typename CONTAINER>
810 inline void getAllEdges(
const Graph& G, CONTAINER& edges);
909 enum class EdgeType { association = 0, generalization = 1, dependency = 2 };
915 generalizationMerger = 2,
916 generalizationExpander = 3,
917 highDegreeExpander = 4,
918 lowDegreeExpander = 5,
1016 std::function<
bool(
node)> includeNode = [](
node) {
return true; },
1017 bool isFastTest =
true)
const;
1027 std::function<
bool(
edge)> includeEdge = [](
edge) {
return true; },
1028 bool isFastTest =
true)
const;
1035 template<
class CONTAINER>
1037 internal::getAllNodes<CONTAINER>(*
this, nodeContainer);
1045 template<
class CONTAINER>
1047 internal::getAllEdges<CONTAINER>(*
this, edgeContainer);
1065 node v = pureNewNode(index);
1145 return newEdge(adjSrc, dir, adjTgt, dir, index);
1167 template<
typename S,
typename T>
1173 insertAdjEntry(tgt, e->
m_adjTgt, dirTgt);
1174 insertAdjEntry(src, e->
m_adjSrc, dirSrc);
1192 virtual void delNode(
node v);
1195 virtual void delEdge(
edge e);
1198 virtual void clear();
1201 void restoreAllEdges();
1235 m_it = m_graph->m_hiddenEdgeSets.pushFront(
this);
1244 m_graph->m_hiddenEdgeSets.del(m_it);
1262 void restore(
edge e);
1319 void unsplit(
node u);
1333 virtual void unsplit(
edge eIn,
edge eOut);
1368 node contract(
edge e,
bool keepSelfLoops =
false);
1436 edge searchEdge(
node v,
node w,
bool directed =
false)
const;
1439 void reverseEdge(
edge e);
1442 void reverseAllEdges();
1451 template<
class NODELIST>
1453 node v = nodesToCollapse.popFrontRet();
1454 while (!nodesToCollapse.empty()) {
1455 node w = nodesToCollapse.popFrontRet();
1457 while (adj !=
nullptr) {
1462 }
else if (e->
source() == w) {
1481 template<
class ADJ_ENTRY_LIST>
1500 std::set<int> entries;
1503 for (
auto it =
begin; it !=
end; ++it) {
1505 entries.insert(adj->
index());
1536 adjList.
move(adjMove, adjList, adjPos, dir);
1570 void reverseAdjEdges();
1612 void consistencyCheck()
const;
1674 void resetEdgeIdCount(
int maxId);
1676 void resetNodeIdCount(
int maxId);
1719 bool notifyObservers =
true>
1720 std::pair<int, int> insert(
const NI& nodesBegin,
const NI& nodesEnd,
const EI& edgesBegin,
1750 template<OGDF_NODE_ITER NI, OGDF_EDGE_FILTER EF,
bool copyIDs = false,
bool notifyObservers = true>
1751 std::pair<int, int> insert(
const NI& nodesBegin,
const NI& nodesEnd,
const EF& edgeFilter,
1762 template<OGDF_NODE_LIST NL>
1763 std::pair<int, int> insert(
const NL& nodeList,
const EdgeSet<true>& edgeSet,
1772 template<OGDF_NODE_LIST NL>
1773 std::pair<int, int> insert(
const NL& nodeList,
const EdgeSet<false>& edgeSet,
1782 template<OGDF_NODE_LIST NL, OGDF_EDGE_LIST EL>
1790 return insert(
begin(nodeList),
end(nodeList),
begin(edgeList),
end(edgeList), nodeMap,
1823 if (!nodeMap.registeredAt()) {
1827 if (!edgeMap.registeredAt()) {
1834 auto count = insert(G.nodes.begin(), G.nodes.end(),
filter_any_edge, nodeMap, edgeMap);
1849 return insert(G, nodeMap, edgeMap);
1853 template<OGDF_NODE_ITER NI,
bool notifyObservers,
bool copyIDs>
1855 int& newNodes,
void* cbData);
1903 virtual void postInsert(
void* userData,
int newNodes,
int newEdges) {};
1940 int stopNode(
int cc)
const {
return m_startNode[cc + 1]; }
1943 return {m_nodes.
begin() + startNode(cc), m_nodes.
begin() + stopNode(cc)};
1947 return {m_edges.
begin() + startEdge(cc), m_edges.
begin() + stopEdge(cc)};
1954 int stopEdge(
int cc)
const {
return m_startEdge[cc + 1]; }
1957 node v(
int i)
const {
return m_nodes[i]; }
1960 edge e(
int i)
const {
return m_edges[i]; }
1973 index = m_nodeIdCount++;
1975 m_nodeIdCount = max(m_nodeIdCount, index + 1);
2009 index = m_edgeIdCount++;
2011 m_edgeIdCount = max(m_edgeIdCount, index + 1);
2071 namespace internal {
2073 template<
typename CONTAINER>
2076 for (
node v : G.nodes) {
2083 nodes.
init(G.numberOfNodes());
2085 for (
node v : G.nodes) {
2090 template<
typename CONTAINER>
2093 for (
edge v : G.edges) {
2100 edges.
init(G.numberOfEdges());
2102 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)
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.
GraphObserver(const Graph *G)
Constructs instance of GraphObserver class.
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 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.