Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

BitonicOrdering.h
Go to the documentation of this file.
1 
34 #pragma once
35 
36 #include <ogdf/basic/Array.h>
37 #include <ogdf/basic/Graph.h>
40 
41 namespace ogdf {
42 class GraphAttributes;
43 template<class E>
44 class List;
45 
47 public:
48  // constructs a bitonic st ordering for G and embeds G accordingly.
49  // Requires G to be planar, embedded, biconnected
50  BitonicOrdering(Graph& G, adjEntry adj_st_edge);
51 
52 #ifdef OGDF_DEBUG
53  void consistencyCheck(GraphAttributes& GA) const;
55 #endif
56 
57  // returns the index in the st order of v
58  int getIndex(node v) const { return m_orderIndex[v]; }
59 
60  // returns the i-th node in the bitonic st order
61  node getNode(int i) const { return m_indexToNode[i]; }
62 
63 private:
64  // used to distinguish between the three cases below
65  void handleCase(node v_T);
66 
67  // helper function that finds the st-adjEntry in the skeleton of v_T
68  adjEntry getAdjST(node v_T) const;
69 
70  // the S-node case
71  void handleSerialCase(node v_T);
72 
73  // the P-node case
74  void handleParallelCase(node v_T);
75 
76  // transforms the result of the canonical ordering into two arrays,
77  // one holding the index in the temporary order for a node,
78  // the other is the reverse map. Function assumes proper init for indices and vertices
79  void partitionToOrderIndices(const List<List<node>>& partitionlist, NodeArray<int>& indices,
80  Array<node>& vertices) const;
81 
82  // the R-node case
83  void handleRigidCase(node v_T);
84 
85  // label a new node
86  void assignLabel(node v_T, node v) {
87  // the real graph node
88  node v_G = m_tree.skeleton(v_T).original(v);
89 
90  // set the label
91  m_orderIndex[v_G] = m_currLabel++;
92 
93  // and update the other map
94  m_indexToNode[m_orderIndex[v_G]] = v_G;
95  }
96 
97  // returns the label of a node v in the skeleton of v_T
98  int getLabel(node v_T, node v) const {
99  // the real graph node
100  node v_G = m_tree.skeleton(v_T).original(v);
101 
102  // return the index
103  return m_orderIndex[v_G];
104  }
105 
106  // mark a skeleton as temporarily flipped
107  void setFlipped(node v_T, bool flag) { m_flipped[v_T] = flag; }
108 
109  // returns true if a skeleton is temporarily flipped
110  bool isFlipped(node v_T) const { return m_flipped[v_T]; }
111 
112  // the graph
114 
115  // the curr label index
117 
118  // index in the order for all graph nodes
120 
121  // maps an index to the node
123 
124  // flag for keeping track of if a node has been temporary flipped
126 
127  // the SPQR tree
129 };
130 
131 }
ogdf::BitonicOrdering::isFlipped
bool isFlipped(node v_T) const
Definition: BitonicOrdering.h:110
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
ogdf::BitonicOrdering::m_flipped
NodeArray< bool > m_flipped
Definition: BitonicOrdering.h:125
Graph.h
Includes declaration of graph class.
ogdf::BitonicOrdering::handleCase
void handleCase(node v_T)
ogdf::BitonicOrdering::partitionToOrderIndices
void partitionToOrderIndices(const List< List< node >> &partitionlist, NodeArray< int > &indices, Array< node > &vertices) const
StaticPlanarSPQRTree.h
Declaration of class StaticPlanarSPQRTree.
ogdf::BitonicOrdering::handleSerialCase
void handleSerialCase(node v_T)
ogdf::BitonicOrdering::handleParallelCase
void handleParallelCase(node v_T)
ogdf::BitonicOrdering::getNode
node getNode(int i) const
Definition: BitonicOrdering.h:61
ogdf::BitonicOrdering::getIndex
int getIndex(node v) const
Definition: BitonicOrdering.h:58
ogdf::BitonicOrdering::setFlipped
void setFlipped(node v_T, bool flag)
Definition: BitonicOrdering.h:107
ogdf::BitonicOrdering::getAdjST
adjEntry getAdjST(node v_T) const
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::BitonicOrdering
Definition: BitonicOrdering.h:46
ogdf::StaticSPQRTree::skeleton
Skeleton & skeleton(node v) const override
Returns the skeleton of node v.
Definition: StaticSPQRTree.h:156
ogdf::BitonicOrdering::handleRigidCase
void handleRigidCase(node v_T)
Skeleton.h
Declaration of class Skeleton.
ogdf::Array< node >
ogdf::BitonicOrdering::m_graph
Graph & m_graph
Definition: BitonicOrdering.h:113
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::BitonicOrdering::consistencyCheck
void consistencyCheck(GraphAttributes &GA) const
Asserts that this ordering is consistent.
ogdf::StaticPlanarSPQRTree
SPQR-trees of planar graphs.
Definition: StaticPlanarSPQRTree.h:55
ogdf::BitonicOrdering::m_currLabel
int m_currLabel
Definition: BitonicOrdering.h:116
ogdf::BitonicOrdering::getLabel
int getLabel(node v_T, node v) const
Definition: BitonicOrdering.h:98
Array.h
Declaration and implementation of Array class and Array algorithms.
ogdf::BitonicOrdering::m_tree
StaticPlanarSPQRTree m_tree
Definition: BitonicOrdering.h:128
ogdf::BitonicOrdering::m_orderIndex
NodeArray< int > m_orderIndex
Definition: BitonicOrdering.h:119
ogdf::Skeleton::original
virtual node original(node v) const =0
Returns the vertex in the original graph G that corresponds to v.
ogdf::BitonicOrdering::m_indexToNode
Array< node > m_indexToNode
Definition: BitonicOrdering.h:122
ogdf::BitonicOrdering::BitonicOrdering
BitonicOrdering(Graph &G, adjEntry adj_st_edge)
ogdf::BitonicOrdering::assignLabel
void assignLabel(node v_T, node v)
Definition: BitonicOrdering.h:86
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240