Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ExpansionGraph.h
Go to the documentation of this file.
1
35#pragma once
36
39#include <ogdf/basic/SList.h>
40
41namespace ogdf {
42
43
50public:
51 // constructor
53
54 // number of biconnected components of G
55 int numberOfBCs() const { return m_component.high() + 1; }
56
57 // returns number of bic. component containing edge e
58 int componentNumber(edge e) const { return m_compNum[e]; }
59
60 void setComponentNumber(edge e, int i) { m_compNum[e] = i; }
61
62 // returns list of edges contained in component i
63 const SListPure<edge>& component(int i) const { return m_component[i]; }
64
65 // returns list of components containing vertex v
66 const SList<int>& adjacentComponents(node v) const { return m_adjComponents[v]; }
67
68 // original node of node v
69 // Precond.: v is a node in the expansion graph
70 node original(node v) const { return m_vOrig[v]; }
71
73 node vOrig = m_vOrig[v];
74 return (vOrig != nullptr) ? vOrig : m_vRep[v];
75 }
76
77 node copy(node vG) const { return m_vCopy[vG]; }
78
79 // original edge of edge e
80 // Precond.: e is a edge in the expansion graph
81 edge original(edge e) const { return m_eOrig[e]; }
82
83 // sets the original node of vCopy to vOriginal
85
86 // initializes to the expansion graph of the i-th biconnected component
87 // of G
88 void init(int i);
89
90 // initializes to the expansion graph of G
91 // advantage is that the vertices in the created copy are created in the
92 // order in which the corresponding originals appear in the list of nodes
93 // in G and therefore mostly have the same indices
94 // mainly for debbugging purposes
95 void init(const Graph& G);
96
97private:
99 node vCopy = m_vCopy[vOrig];
100 if (vCopy == nullptr) {
101 vCopy = newNode();
102 m_vOrig[m_vCopy[vOrig] = vCopy] = vOrig;
103 }
104 return vCopy;
105 }
106
107 EdgeArray<int> m_compNum; // component of edge e
108 Array<SListPure<edge>> m_component; // edges in i-th biconnected comp.
109 NodeArray<SList<int>> m_adjComponents; // components containing v
110 NodeArray<node> m_vCopy; // copy of original vertex
111 NodeArray<node> m_vOrig; // original vertex of copy
113 EdgeArray<edge> m_eOrig; // original edge of copy
114};
115
116
117}
Declaration and implementation of EdgeArray class.
Declaration and implementation of NodeArray class.
Declaration of singly linked lists and iterators.
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
Dynamic arrays indexed with edges.
Definition EdgeArray.h:125
Class for the representation of edges.
Definition Graph_d.h:300
Represents expansion graph of each biconnected component of a given digraph, i.e.,...
void setOriginal(node vCopy, node vOriginal)
Array< SListPure< edge > > m_component
ExpansionGraph(const Graph &G)
const SList< int > & adjacentComponents(node v) const
node representative(node v) const
EdgeArray< int > m_compNum
node getCopy(node vOrig)
node original(node v) const
void init(const Graph &G)
node copy(node vG) const
EdgeArray< edge > m_eOrig
void setComponentNumber(edge e, int i)
NodeArray< SList< int > > m_adjComponents
const SListPure< edge > & component(int i) const
edge original(edge e) const
int componentNumber(edge e) const
NodeArray< node > m_vOrig
NodeArray< node > m_vCopy
NodeArray< node > m_vRep
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
Singly linked lists (maintaining the length of the list).
Definition SList.h:833
Singly linked lists.
Definition SList.h:179
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.