Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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