Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

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  // debug consistency check
54 
55  // returns the index in the st order of v
56  int getIndex(node v) const
57  {
58  return m_orderIndex[v];
59  }
60 
61  // returns the i-th node in the bitonic st order
62  node getNode(int i) const
63  {
64  return m_indexToNode[i];
65  }
66 private:
67 
68  // used to distinguish between the three cases below
69  void handleCase(node v_T);
70 
71  // helper function that finds the st-adjEntry in the skeleton of v_T
72  adjEntry getAdjST(node v_T) const;
73 
74  // the S-node case
75  void handleSerialCase(node v_T);
76 
77  // the P-node case
78  void handleParallelCase(node v_T);
79 
80  // transforms the result of the canonical ordering into two arrays,
81  // one holding the index in the temporary order for a node,
82  // the other is the reverse map. Function assumes proper init for indices and vertices
83  void partitionToOrderIndices(const List<List<node> >& partitionlist,
84  NodeArray<int>& indices,
85  Array<node>& vertices) const;
86 
87  // the R-node case
88  void handleRigidCase(node v_T);
89 
90  // label a new node
91  void assignLabel(node v_T, node v)
92  {
93  // the real graph node
94  node v_G = m_tree.skeleton(v_T).original(v);
95 
96  // set the label
97  m_orderIndex[v_G] = m_currLabel++;
98 
99  // and update the other map
100  m_indexToNode[m_orderIndex[v_G]] = v_G;
101  }
102 
103  // returns the label of a node v in the skeleton of v_T
104  int getLabel(node v_T, node v) const
105  {
106  // the real graph node
107  node v_G = m_tree.skeleton(v_T).original(v);
108 
109  // return the index
110  return m_orderIndex[v_G];
111  }
112 
113  // mark a skeleton as temporarily flipped
114  void setFlipped(node v_T, bool flag)
115  {
116  m_flipped[v_T] = flag;
117  }
118 
119  // returns true if a skeleton is temporarily flipped
120  bool isFlipped(node v_T) const
121  {
122  return m_flipped[v_T];
123  }
124 
125  // the graph
127 
128  // the curr label index
130 
131  // index in the order for all graph nodes
133 
134  // maps an index to the node
136 
137  // flag for keeping track of if a node has been temporary flipped
139 
140  // the SPQR tree
142 }; // end of BitonicOrdering
143 
144 } // end of namespace ogdf
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:472
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)
bool consistencyCheck(GraphAttributes &GA)
Stores additional attributes of a graph (like layout information).
Doubly linked lists (maintaining the length of the list).
Definition: List.h:39
adjEntry getAdjST(node v_T) const
Class for the representation of nodes.
Definition: Graph_d.h:167
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:78
void partitionToOrderIndices(const List< List< node > > &partitionlist, NodeArray< int > &indices, Array< node > &vertices) const
NodeArray< bool > m_flipped