Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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
41namespace ogdf {
42class GraphAttributes;
43template<class E>
44class List;
45
47public:
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
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
63private:
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
69
70 // the S-node case
72
73 // the P-node case
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
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
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}
Declaration and implementation of Array class and Array algorithms.
Includes declaration of graph class.
Declaration of class Skeleton.
Declaration of class StaticPlanarSPQRTree.
Class for adjacency list elements.
Definition Graph_d.h:143
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:219
void setFlipped(node v_T, bool flag)
int getIndex(node v) const
adjEntry getAdjST(node v_T) const
void handleParallelCase(node v_T)
void consistencyCheck(GraphAttributes &GA) const
Asserts that this ordering is consistent.
node getNode(int i) const
void partitionToOrderIndices(const List< List< node > > &partitionlist, NodeArray< int > &indices, Array< node > &vertices) const
StaticPlanarSPQRTree m_tree
Array< node > m_indexToNode
bool isFlipped(node v_T) const
void handleCase(node v_T)
BitonicOrdering(Graph &G, adjEntry adj_st_edge)
NodeArray< int > m_orderIndex
void handleSerialCase(node v_T)
void handleRigidCase(node v_T)
NodeArray< bool > m_flipped
void assignLabel(node v_T, node v)
int getLabel(node v_T, node v) const
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
Doubly linked lists (maintaining the length of the list).
Definition List.h:1451
Class for the representation of nodes.
Definition Graph_d.h:241
virtual node original(node v) const =0
Returns the vertex in the original graph G that corresponds to v.
SPQR-trees of planar graphs.
Skeleton & skeleton(node v) const override
Returns the skeleton of node v.
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
The namespace for all OGDF objects.