Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ShellingOrder.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Array.h>
35 #include <ogdf/basic/Graph.h>
36 #include <ogdf/basic/basic.h>
37 
38 namespace ogdf {
39 template<class E>
40 class List;
41 
45 class ShellingOrderSet : public Array<node> {
46 public:
49  m_leftVertex = m_rightVertex = nullptr;
50  m_leftAdj = m_rightAdj = nullptr;
51  }
52 
54 
59  ShellingOrderSet(int n, adjEntry adjL = nullptr, adjEntry adjR = nullptr) : Array<node>(1, n) {
60  m_leftVertex = (adjL != nullptr) ? adjL->twinNode() : nullptr;
61  m_rightVertex = (adjR != nullptr) ? adjR->twinNode() : nullptr;
62  m_leftAdj = adjL;
63  m_rightAdj = adjR;
64  }
65 
67  node left() const { return m_leftVertex; }
68 
70  node right() const { return m_rightVertex; }
71 
73  adjEntry leftAdj() const { return m_leftAdj; }
74 
76  adjEntry rightAdj() const { return m_rightAdj; }
77 
79  bool hasLeft() const { return m_leftAdj != nullptr; }
80 
82  bool hasRight() const { return m_rightAdj != nullptr; }
83 
85  void left(node cl) { m_leftVertex = cl; }
86 
88  void right(node cr) { m_rightVertex = cr; }
89 
91  void leftAdj(adjEntry adjL) { m_leftAdj = adjL; }
92 
94  void rightAdj(adjEntry adjR) { m_rightAdj = adjR; }
95 
97  int len() const { return high(); }
98 
100  node operator[](const int i) const { return Array<node>::operator[](i); }
101 
103  node& operator[](const int i) { return Array<node>::operator[](i); }
104 
105 
106 private:
111 };
112 
117 public:
119  ShellingOrder() { m_pGraph = nullptr; }
120 
121 #if 0
122  ShellingOrder(const Graph &G, const List<ShellingOrderSet> &partition);
123 #endif
124 
126 
128  const Graph& getGraph() const { return *m_pGraph; }
129 
131  int length() const { return m_V.high(); }
132 
134  int len(int i) const { return m_V[i].len(); }
135 
137  node operator()(int i, int j) const { return (m_V[i])[j]; }
138 
140  const ShellingOrderSet& operator[](int i) const { return m_V[i]; }
141 
143  node left(int i) const { return m_V[i].left(); }
144 
146  node right(int i) const { return m_V[i].right(); }
147 
149  int rank(node v) const { return m_rank[v]; }
150 
156  void init(const Graph& G, const List<ShellingOrderSet>& partition);
157 
163  void initLeftmost(const Graph& G, const List<ShellingOrderSet>& partition);
164 
165 
166  void push(int k, node v, node tgt);
167 
168  friend class CompOrderBic;
169 
170 private:
171  const Graph* m_pGraph;
174 };
175 
176 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
Graph.h
Includes declaration of graph class.
ogdf::ShellingOrder::m_rank
NodeArray< int > m_rank
the rank of nodes.
Definition: ShellingOrder.h:173
ogdf::ShellingOrderSet::operator[]
node operator[](const int i) const
Returns the i-th node in the order set from left (the leftmost node has index 1).
Definition: ShellingOrder.h:100
ogdf::ShellingOrderSet::len
int len() const
Returns the length of the order set, i.e., the number of contained nodes.
Definition: ShellingOrder.h:97
ogdf::ShellingOrderSet::leftAdj
void leftAdj(adjEntry adjL)
Sets the adjacency entry pointing to the left-node to adjL.
Definition: ShellingOrder.h:91
ogdf::ShellingOrderSet
The node set in a shelling order of a graph.
Definition: ShellingOrder.h:45
ogdf::Array< node >::high
int high() const
Returns the maximal array index.
Definition: Array.h:299
ogdf::ShellingOrderSet::leftAdj
adjEntry leftAdj() const
Returns the adjacency entry pointing from z1 to the left node (or 0 if no such node).
Definition: ShellingOrder.h:73
ogdf::ShellingOrderSet::hasLeft
bool hasLeft() const
Returns true iff the adjacency entry to the left-node exists.
Definition: ShellingOrder.h:79
ogdf::ShellingOrder::left
node left(int i) const
Returns the left-node of the i-th set Vi.
Definition: ShellingOrder.h:143
ogdf::ShellingOrderSet::ShellingOrderSet
ShellingOrderSet()
Creates an empty shelling order set.
Definition: ShellingOrder.h:48
ogdf::ShellingOrderSet::operator[]
node & operator[](const int i)
Returns the i-th node in the order set from left (the leftmost node has index 1).
Definition: ShellingOrder.h:103
ogdf::ShellingOrder::getGraph
const Graph & getGraph() const
Returns the graph associated with the shelling order.
Definition: ShellingOrder.h:128
ogdf::ShellingOrderSet::rightAdj
void rightAdj(adjEntry adjR)
Sets the adjacency entry pointing to the right-node to adjR.
Definition: ShellingOrder.h:94
ogdf::ShellingOrderSet::rightAdj
adjEntry rightAdj() const
Returns the adjacency entry pointing from zp to the right node (or 0 if no such node).
Definition: ShellingOrder.h:76
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::ShellingOrderSet::m_leftAdj
adjEntry m_leftAdj
the adjacency entry pointing to the left-node.
Definition: ShellingOrder.h:109
ogdf::ShellingOrder::operator()
node operator()(int i, int j) const
Returns the j-th node of the i-th order set Vi.
Definition: ShellingOrder.h:137
ogdf::ShellingOrder::~ShellingOrder
~ShellingOrder()
Definition: ShellingOrder.h:125
ogdf::ShellingOrderSet::m_leftVertex
node m_leftVertex
the left-node of the set.
Definition: ShellingOrder.h:107
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:219
ogdf::ShellingOrderSet::hasRight
bool hasRight() const
Returns true iff the adjacency entry to the right-node exists.
Definition: ShellingOrder.h:82
ogdf::Array::operator[]
const_reference operator[](INDEX i) const
Returns a reference to the element at position i.
Definition: Array.h:308
ogdf::ShellingOrderSet::left
void left(node cl)
Sets the left-node to cl.
Definition: ShellingOrder.h:85
ogdf::ShellingOrder::length
int length() const
Returns the number of sets in the node partition.
Definition: ShellingOrder.h:131
ogdf::ShellingOrder::rank
int rank(node v) const
Returns the rank of node v, where rank(v) = i iff v is contained in Vi.
Definition: ShellingOrder.h:149
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::ShellingOrder::len
int len(int i) const
Returns the length of the i-th order set Vi.
Definition: ShellingOrder.h:134
ogdf::graphics::init
void init()
Definition: graphics.h:450
ogdf::ShellingOrder::ShellingOrder
ShellingOrder()
Creates an empty shelling order.
Definition: ShellingOrder.h:119
ogdf::ShellingOrder::m_pGraph
const Graph * m_pGraph
the associated graph.
Definition: ShellingOrder.h:171
ogdf::ShellingOrderSet::m_rightVertex
node m_rightVertex
the right-node of the set.
Definition: ShellingOrder.h:108
ogdf::ShellingOrderSet::right
void right(node cr)
Sets the right-node to cr.
Definition: ShellingOrder.h:88
basic.h
Basic declarations, included by all source files.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
Array.h
Declaration and implementation of Array class and Array algorithms.
ogdf::ShellingOrderSet::ShellingOrderSet
ShellingOrderSet(int n, adjEntry adjL=nullptr, adjEntry adjR=nullptr)
Creates a shelling order set for n nodes.
Definition: ShellingOrder.h:59
ogdf::ShellingOrder::operator[]
const ShellingOrderSet & operator[](int i) const
Returns the i-th set V_i
Definition: ShellingOrder.h:140
ogdf::ShellingOrder::right
node right(int i) const
Returns the right-node of the i-th set Vi.
Definition: ShellingOrder.h:146
ogdf::ShellingOrderSet::left
node left() const
Returns the left-node of the set.
Definition: ShellingOrder.h:67
ogdf::ShellingOrder::m_V
Array< ShellingOrderSet > m_V
the node partition.
Definition: ShellingOrder.h:172
ogdf::ShellingOrderSet::m_rightAdj
adjEntry m_rightAdj
the adjacency entry pointing to the right-node.
Definition: ShellingOrder.h:110
ogdf::ShellingOrder
The shelling order of a graph.
Definition: ShellingOrder.h:116
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::ShellingOrderSet::right
node right() const
Returns the right-node of the set.
Definition: ShellingOrder.h:70