Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

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