97 operator edge()
const {
return m_edge; }
111 bool isSource()
const;
155 const Graph *graphOf()
const;
178 const Graph *m_pGraph;
190 m_indeg(0), m_outdeg(0), m_id(id), m_pGraph(pGraph) { }
204 int indeg()
const {
return m_indeg; }
208 int degree()
const {
return m_indeg + m_outdeg; }
225 template<
class ADJLIST>
228 for(
adjEntry adj : this->adjEntries) {
229 adjList.pushBack(adj);
241 template<
class EDGELIST>
244 for(
adjEntry adj : this->adjEntries) {
245 edgeList.pushBack(adj->theEdge());
254 template<
class EDGELIST>
255 void inEdges(EDGELIST &edgeList)
const;
262 template<
class EDGELIST>
263 void outEdges(EDGELIST &edgeList)
const;
266 const Graph *graphOf()
const {
return m_pGraph; }
280 return (m_next) ?
static_cast<adjEntry>(m_next) : m_node->firstAdj();
285 return (m_prev) ?
static_cast<adjEntry>(m_prev) : m_node->lastAdj();
310 m_src(src), m_tgt(tgt), m_adjSrc(adjSrc), m_adjTgt(adjTgt), m_id(id) { }
319 m_src(src), m_tgt(tgt), m_id(id) { }
345 const Graph *graphOf()
const {
return m_src->graphOf(); }
359 return v == m_src ? m_adjSrc : m_adjTgt;
370 bool m_hidden =
false;
376 inline const Graph *AdjElement::graphOf()
const {
377 return m_node->graphOf();
382 return this == m_edge->adjSource();
387 node v = this->theNode();
391 bool result =
this != adjBefore &&
this != adjAfter && adjBefore != adjAfter;
395 for (; adj !=
this && adj != adjAfter; adj = adj->
cyclicSucc());
396 result = adj ==
this;
402 template<
class EDGELIST>
405 for(
adjEntry adj : this->adjEntries) {
406 edge e = adj->theEdge();
407 if (adj == e->
adjTarget()) edgeList.pushBack(e);
411 template<
class EDGELIST>
414 for(
adjEntry adj : this->adjEntries) {
415 edge e = adj->theEdge();
416 if (adj == e->
adjSource()) edgeList.pushBack(e);
488 #ifndef OGDF_MEMORY_POOL_NTS 528 generalizationMerger = 2,
529 generalizationExpander = 3,
530 highDegreeExpander = 4,
531 lowDegreeExpander = 5,
614 node chooseNode(std::function<
bool(
node)> includeNode = [](
node) {
return true; },
bool isFastTest =
true)
const;
623 edge chooseEdge(std::function<
bool(
edge)> includeEdge = [](
edge) {
return true; },
bool isFastTest =
true)
const;
630 template<
class NODELIST>
633 for (
node v = nodes.
head(); v; v = v->succ())
634 nodeList.pushBack(v);
642 template<
class EDGELIST>
645 for (
edge e = edges.
head(); e; e = e->succ())
646 edgeList.pushBack(e);
669 node newNode(
int index);
743 virtual void delNode(
node v);
746 virtual void delEdge(
edge e);
749 virtual void clear();
783 m_it = m_graph->m_hiddenEdgeSets.pushFront(
this);
793 m_graph->m_hiddenEdgeSets.del(m_it);
811 void restore(
edge e);
864 void unsplit(
node u);
878 virtual void unsplit(
edge eIn,
edge eOut);
975 void reverseEdge(
edge e);
978 void reverseAllEdges();
987 template<
class NODELIST>
989 node v = nodesToCollapse.popFrontRet();
990 while (!nodesToCollapse.empty())
992 node w = nodesToCollapse.popFrontRet();
994 while (adj !=
nullptr)
1000 else if (e->
source() == w)
1018 template<
class ADJ_ENTRY_LIST>
1021 std::set<int> entries;
1025 entries.insert(adj->index());
1058 adjList.move(adjMove, adjList, adjPos, dir);
1092 void reverseAdjEdges();
1133 return genus() == 0;
1142 bool consistencyCheck()
const;
1256 void resetEdgeIdCount(
int maxId);
1282 static int nextPower2(
int start,
int idCount);
1319 int stopNode (
int cc)
const {
return m_startNode[cc+1]; }
1325 int stopEdge (
int cc)
const {
return m_startEdge[cc+1]; }
1328 node v(
int i)
const {
return m_nodes[i]; }
1331 edge e(
int i)
const {
return m_edges[i]; }
1344 void constructInitByNodes(
1350 void constructInitByActiveNodes(
1357 void constructInitByCC(
1374 void reinitArrays();
1375 void reinitStructures();
1376 void resetAdjEntryIndex(
int newIndex,
int oldIndex);
1381 void restoreAllEdges();
node target() const
Returns the target node of the edge.
void adjEdges(EDGELIST &edgeList) const
Returns a list with all edges incident to this node.
int m_nodeIdCount
The Index that will be assigned to the next created node.
void moveAdjBefore(adjEntry adjMove, adjEntry adjBefore)
Moves adjacency entry adjMove before adjBefore.
bool isSource() const
Returns true iff this is the source adjacency entry of the corresponding edge.
Abstract base class for node arrays.
node m_tgt
The target node of the edge.
EdgeElement * edge
The type of edges.
Array< int > m_startEdge
start edge of each connected component in m_edges.
Functionality for temporarily hiding edges in constant time.
int numberOfEdges(int cc) const
Returns the number of edges in connected component cc.
adjEntry pred() const
Returns the predecessor in the adjacency list.
HiddenEdgeSet(Graph &graph)
Creates a new set of hidden edges.
node pred() const
Returns the predecessor in the list of all nodes.
edge theEdge() const
Returns the edge associated with this adjacency entry.
Data type for general directed graphs (adjacency list representation).
edge m_edge
The associated edge.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
static int compare(const AdjElement &x, const AdjElement &y)
Standard Comparer.
adjEntry adjSource() const
Returns the corresponding adjacancy entry at source node.
AdjElement(node v)
Constructs an adjacency element for a given node.
void sort(node v, const ADJ_ENTRY_LIST &newOrder)
Sorts the adjacency list of node v according to newOrder.
void moveAdj(adjEntry adjMove, Direction dir, adjEntry adjPos)
Moves adjacency entry adjMove before or after adjPos.
#define OGDF_MALLOC_NEW_DELETE
Makes the class use malloc for memory allocation.
ListIterator< HiddenEdgeSet * > m_it
edge e(int i) const
Returns the edge with index i.
int degree() const
Returns the degree of the node (indegree + outdegree).
int stopNode(int cc) const
Returns the index of (one past) the last node in connected component cc.
int maxAdjEntryIndex() const
Returns the largest used adjEntry index.
int startEdge(int cc) const
Returns the index of the first edge in connected component cc.
#define OGDF_AUGMENT_STATICCOMPARER(type)
Add this macro to your class to turn it into a full static comparer.
int indeg() const
Returns the indegree of the node.
int outdeg() const
Returns the outdegree of the node.
adjEntry faceCyclePred() const
Returns the cyclic predecessor in face.
node firstNode() const
Returns the first node in the list of all nodes.
void outEdges(EDGELIST &edgeList) const
Returns a list with all outgoing edges of this node.
int numberOfCCs() const
Returns the number of connected components.
int index() const
Returns the index of the edge.
Dynamic arrays indexed with adjacency entries.
Array< int > m_startNode
start node of each connected component in m_nodes.
node v(int i) const
Returns the node with index i.
Dynamic arrays indexed with edges.
node succ() const
Returns the successor in the list of all nodes.
bool representsCombEmbedding() const
Returns true iff the graph represents a combinatorial embedding.
Decralation of graph iterators.
Array< edge > m_edges
array of all edges.
adjEntry cyclicSucc() const
Returns the cyclic successor in the adjacency list.
GraphObject * tail() const
Returns the last element in the list.
edge lastEdge() const
Returns the last edge in the list of all edges.
CCsInfo()
Creates a info structure associated with no graph.
ostream & operator<<(ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
Decralation of GraphElement and GraphList classes.
adjEntry faceCycleSucc() const
Returns the cyclic successor in face.
int m_edgeIdCount
The Index that will be assigned to the next created edge.
int size() const
Returns the number of elements in the container.
void moveAdjAfter(adjEntry adjMove, adjEntry adjAfter)
Moves adjacency entry adjMove after adjAfter.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
int adjEntryArrayTableSize() const
Returns the table size of adjEntry arrays associated with this graph.
const Graph & constGraph() const
Returns the associated graph.
int numberOfEdges() const
Returns the number of edges in the graph.
int m_edgeArrayTableSize
The current table size of edge arrays associated with this graph.
Dynamic arrays indexed with nodes.
int m_id
The (unique) index of the adjacency entry.
void inEdges(EDGELIST &edgeList) const
Returns a list with all incoming edges of this node.
EdgeElement(node src, node tgt, int id)
Constructs an edge element (src,tgt).
void collapse(NODELIST &nodesToCollapse)
Collapses all nodes in the list nodesToCollapse to the first node in the list.
int edgeArrayTableSize() const
Returns the table size of edge arrays associated with this graph.
edge firstEdge() const
Returns the first edge in the list of all edges.
static void copy(const T &from, T &to)
bool isBetween(adjEntry adjBefore, adjEntry adjAfter) const
Returns whether this adjacency entry lies between adjBefore and adjAfter in clockwise rotation...
EdgeType
The type of edges (only used in derived classes).
GraphObject * head() const
Returns the first element in the list.
Bucket function using the index of an edge's source node as bucket.
internal::GraphList< EdgeElement > m_edges
Abstract base class for adjacency entry arrays.
ListPure< EdgeArrayBase * > m_regEdgeArrays
The registered edge arrays.
AdjElement * m_adjSrc
Corresponding adjacancy entry at source node.
ListPure< AdjEntryArrayBase * > m_regAdjArrays
The registered adjEntry arrays.
Doubly linked lists (maintaining the length of the list).
ListPure< GraphObserver * > m_regStructures
The registered graph structures.
static int compare(const EdgeElement &x, const EdgeElement &y)
Standard Comparer.
Bucket function using the index of an edge's target node as bucket.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Class for the representation of edges.
void allEdges(EDGELIST &edgeList) const
Returns a list with all edges of the graph.
adjEntry twin() const
Returns the corresponding adjacency element associated with the same edge.
int m_numCC
the number of connected components.
Base class for GraphElement lists.
void allAdjEntries(ADJLIST &adjList) const
Returns a list with all adjacency entries of this node.
int m_indeg
The indegree of the node.
The base class for objects used by (hyper)graphs.
AdjElement(edge e, int id)
Constructs an adjacency entry for a given edge and index.
adjEntry lastAdj() const
Returns the last entry in the adjacency list.
Class for the representation of nodes.
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 ...
Encapsulates a pointer to a list element.
node lastNode() const
Returns the last node in the list of all nodes.
node opposite(node v) const
Returns the adjacent node different from v.
ListPure< NodeArrayBase * > m_regNodeArrays
The registered node arrays.
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
adjEntry counterClockwiseFacePred() const
Returns the counter-clockwise predecessor in face.
AdjElement * m_twin
The corresponding adjacency entry (same edge)
adjEntry clockwiseFacePred() const
Returns the clockwise predecessor in face. Use faceCycleSucc instead!
const T & move(const T &v)
int getBucket(const edge &e) override
Returns target index of e.
std::mutex m_mutexRegArrays
The critical section for protecting shared acces to register/unregister methods.
bool empty() const
Returns true iff the list is empty.
int getBucket(const edge &e) override
Returns source index of e.
Info structure for maintaining connected components.
adjEntry cyclicPred() const
Returns the cyclic predecessor in the adjacency list.
const Graph * m_graph
points to the associated graph.
Abstract base class for bucket functions.
Array< node > m_nodes
array of all nodes.
EdgeElement(node src, node tgt, AdjElement *adjSrc, AdjElement *adjTgt, int id)
Constructs an edge element (src,tgt).
~HiddenEdgeSet()
Restores all hidden edges.
edge pred() const
Returns the predecessor in the list of all edges.
adjEntry counterClockwiseFaceSucc() const
Returns the counter-clockwise successor in face.
int m_outdeg
The outdegree of the node.
int index() const
Returns the (unique) node index.
edge succ() const
Returns the successor in the list of all edges.
bool isIncident(node v) const
Returns true iff v is incident to the edge.
adjEntry succ() const
Returns the successor in the adjacency list.
void swapAdjEdges(adjEntry adj1, adjEntry adj2)
Exchanges two entries in an adjacency list.
int nodeArrayTableSize() const
Returns the table size of node arrays associated with this graph.
void reverseAdjEdges(node v)
Reverses the adjacency list of v.
void allNodes(NODELIST &nodeList) const
Returns a list with all nodes of the graph.
NodeElement(int id)
Constructs a node element with index id.
int stopEdge(int cc) const
Returns the index of (one past) the last edge in connected component cc.
int maxNodeIndex() const
Returns the largest used node index.
node source() const
Returns the source node of the edge.
Abstract base class for edge arrays.
int numberOfNodes(int cc) const
Returns the number of nodes in connected component cc.
The namespace for all OGDF objects.
int maxEdgeIndex() const
Returns the largest used edge index.
node m_node
The node whose adjacency list contains this entry.
int startNode(int cc) const
Returns the index of the first node in connected component cc.
NodePair(node src, node tgt)
Lists of graph objects (like nodes, edges, etc.).
NodeType
The type of nodes.
AdjElement * m_adjTgt
Corresponding adjacancy entry at target node.
int numberOfNodes() const
Returns the number of nodes in the graph.
int index() const
Returns the index of this adjacency element.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
adjEntry firstAdj() const
Returns the first entry in the adjaceny list.
int m_nodeArrayTableSize
The current table size of node arrays associated with this graph.
node commonNode(edge e) const
Returns the common node of the edge and e. Returns nullptr if the two edges are not adjacent...
int m_id
The (unique) index of the node.
adjEntry adjTarget() const
Returns the corresponding adjacancy entry at target node.
List< HiddenEdgeSet * > m_hiddenEdgeSets
The list of hidden edges.
node m_src
The source node of the edge.
bool empty() const
Returns true iff the graph is empty, i.e., contains no nodes.
node theNode() const
Returns the node whose adjacency list contains this element.
Class for adjacency list elements.
Abstract Base class for graph observers.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static int compare(const NodeElement &x, const NodeElement &y)
Standard Comparer.
adjEntry clockwiseFaceSucc() const
Returns the clockwise successor in face. Use faceCycleSucc instead!
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.