Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ShellingOrder.h
Go to the documentation of this file.
1
32#pragma once
33
35
36namespace ogdf {
37
38
42class ShellingOrderSet : public Array<node> {
43public:
46 m_leftVertex = m_rightVertex = nullptr;
47 m_leftAdj = m_rightAdj = nullptr;
48 }
49
51
56 ShellingOrderSet(int n, adjEntry adjL = nullptr, adjEntry adjR = nullptr) : Array<node>(1, n) {
57 m_leftVertex = (adjL != nullptr) ? adjL->twinNode() : nullptr;
58 m_rightVertex = (adjR != nullptr) ? adjR->twinNode() : nullptr;
61 }
62
64 node left() const { return m_leftVertex; }
65
67 node right() const { return m_rightVertex; }
68
70 adjEntry leftAdj() const { return m_leftAdj; }
71
73 adjEntry rightAdj() const { return m_rightAdj; }
74
76 bool hasLeft() const { return m_leftAdj != nullptr; }
77
79 bool hasRight() const { return m_rightAdj != nullptr; }
80
82 void left(node cl) { m_leftVertex = cl; }
83
86
89
92
94 int len() const { return high(); }
95
97 node operator[](const int i) const { return Array<node>::operator[](i); }
98
100 node& operator[](const int i) { return Array<node>::operator[](i); }
101
102
103private:
108};
109
114public:
116 ShellingOrder() { m_pGraph = nullptr; }
117
118#if 0
119 ShellingOrder(const Graph &G, const List<ShellingOrderSet> &partition);
120#endif
121
123
125 const Graph& getGraph() const { return *m_pGraph; }
126
128 int length() const { return m_V.high(); }
129
131 int len(int i) const { return m_V[i].len(); }
132
134 node operator()(int i, int j) const { return (m_V[i])[j]; }
135
137 const ShellingOrderSet& operator[](int i) const { return m_V[i]; }
138
140 node left(int i) const { return m_V[i].left(); }
141
143 node right(int i) const { return m_V[i].right(); }
144
146 int rank(node v) const { return m_rank[v]; }
147
153 void init(const Graph& G, const List<ShellingOrderSet>& partition);
154
160 void initLeftmost(const Graph& G, const List<ShellingOrderSet>& partition);
161
162
163 void push(int k, node v, node tgt);
164
165 friend class CompOrderBic;
166
167private:
171};
172
173}
Declaration and implementation of NodeArray class.
Class for adjacency list elements.
Definition Graph_d.h:79
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
const_reference operator[](INDEX i) const
Returns a reference to the element at position i.
Definition Array.h:303
int high() const
Returns the maximal array index.
Definition Array.h:294
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Doubly linked lists (maintaining the length of the list).
Definition List.h:1435
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
The shelling order of a graph.
node right(int i) const
Returns the right-node of the i-th set Vi.
const ShellingOrderSet & operator[](int i) const
Returns the i-th set V_i
const Graph & getGraph() const
Returns the graph associated with the shelling order.
NodeArray< int > m_rank
the rank of nodes.
void init(const Graph &G, const List< ShellingOrderSet > &partition)
Initializes the shelling order for graph G with a given node partition.
void initLeftmost(const Graph &G, const List< ShellingOrderSet > &partition)
Initializes the shelling order for graph G with a given node partition and transforms it into a leftm...
void push(int k, node v, node tgt)
Array< ShellingOrderSet > m_V
the node partition.
const Graph * m_pGraph
the associated graph.
node operator()(int i, int j) const
Returns the j-th node of the i-th order set Vi.
ShellingOrder()
Creates an empty shelling order.
int length() const
Returns the number of sets in the node partition.
int len(int i) const
Returns the length of the i-th order set Vi.
node left(int i) const
Returns the left-node of the i-th set Vi.
int rank(node v) const
Returns the rank of node v, where rank(v) = i iff v is contained in Vi.
The node set in a shelling order of a graph.
ShellingOrderSet(int n, adjEntry adjL=nullptr, adjEntry adjR=nullptr)
Creates a shelling order set for n nodes.
adjEntry m_leftAdj
the adjacency entry pointing to the left-node.
node left() const
Returns the left-node of the set.
void left(node cl)
Sets the left-node to cl.
node m_leftVertex
the left-node of the set.
node operator[](const int i) const
Returns the i-th node in the order set from left (the leftmost node has index 1).
bool hasRight() const
Returns true iff the adjacency entry to the right-node exists.
adjEntry m_rightAdj
the adjacency entry pointing to the right-node.
adjEntry leftAdj() const
Returns the adjacency entry pointing from z1 to the left node (or 0 if no such node).
ShellingOrderSet()
Creates an empty shelling order set.
node & operator[](const int i)
Returns the i-th node in the order set from left (the leftmost node has index 1).
adjEntry rightAdj() const
Returns the adjacency entry pointing from zp to the right node (or 0 if no such node).
node m_rightVertex
the right-node of the set.
node right() const
Returns the right-node of the set.
int len() const
Returns the length of the order set, i.e., the number of contained nodes.
void leftAdj(adjEntry adjL)
Sets the adjacency entry pointing to the left-node to adjL.
void right(node cr)
Sets the right-node to cr.
bool hasLeft() const
Returns true iff the adjacency entry to the left-node exists.
void rightAdj(adjEntry adjR)
Sets the adjacency entry pointing to the right-node to adjR.
#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.