Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

CPlanarSubClusteredST.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/EdgeArray.h>
37 
38 namespace ogdf {
39 namespace cluster_planarity {
40 
43 public:
45 
47  virtual void call(const ClusterGraph& CG, EdgeArray<bool>& inST);
50  virtual void call(const ClusterGraph& CG, EdgeArray<bool>& inST, EdgeArray<double>& weight);
51 
52 private:
54  void dfsBuildOriginalST(/*ClusterGraph& CG,*/
55  node v,
56  ClusterArray<EdgeArray<bool>>& treeEdges, //edges in repgraph
57  EdgeArray<bool>& inST, //original edges
58  NodeArray<bool>& visited);
59  //builds spanning tree on graph of node v in treeEdges
60  void dfsBuildSpanningTree(node v, EdgeArray<bool>& treeEdges, NodeArray<bool>& visited);
61 
66  // insert nodes for all child clusters
68  for (auto child : c->children) {
69  node v = g.newNode();
70  m_cRepNode[child] = v;
71  }
72  // insert nodes for all node entries in c
74  for (auto u : c->nodes) {
75  node v = g.newNode();
76  m_vRepNode[u] = v;
77  }
78  }
79 
82  for (edge e : CG.constGraph().edges) {
83  //insert representation in RepGraph[allocation cluster]
84  //defined by lowest common ancestor of end points
85  node u = e->source();
86  node v = e->target();
87  cluster uAncestor, vAncestor;
88  cluster allocCluster = CG.commonClusterLastAncestors(u, v, uAncestor, vAncestor);
89  m_allocCluster[e] = allocCluster;
90  //now derive the real ancestors (maybe the nodes themselves from
91  //the supplied clusters
92 
93  //Case1: both nodes in same cluster => connect the nodes in the
94  //cluster representation graph
95  if (uAncestor == vAncestor) {
96  m_repEdge[e] = RepGraph[uAncestor]->newEdge(m_vRepNode[u], m_vRepNode[v]);
97  } else {
98  OGDF_ASSERT(uAncestor != CG.rootCluster() || vAncestor != CG.rootCluster());
99  //now only one node can be directly in rootcluster
100  //this case now seems to fall together with else else...
101  if (uAncestor == CG.rootCluster()) {
102  m_repEdge[e] = RepGraph[uAncestor]->newEdge(m_vRepNode[u], m_cRepNode[vAncestor]);
103  } else if (vAncestor == CG.rootCluster()) {
104  m_repEdge[e] = RepGraph[vAncestor]->newEdge(m_cRepNode[uAncestor], m_vRepNode[v]);
105  } else {
106  OGDF_ASSERT(allocCluster != nullptr);
107  //now create edge in lowest common cluster
108  node v1, v2;
109  v1 = ((uAncestor == nullptr) ? m_vRepNode[u] : m_cRepNode[uAncestor]);
110  v2 = ((vAncestor == nullptr) ? m_vRepNode[v] : m_cRepNode[vAncestor]);
111  m_repEdge[e] = RepGraph[allocCluster]->newEdge(v1, v2);
112  }
113  }
114  }
115  }
116 
119  for (cluster c : CG.clusters) {
120  RepGraph[c] = new Graph;
121  constructRepresentationGraphNodes(CG, *RepGraph[c], c);
122  }
123  constructRepresentationGraphEdges(CG, RepGraph);
124  }
125 
127  for (cluster c : CG.clusters) {
128  delete RepGraph[c];
129  }
130  }
131 
133  void initialize(const ClusterGraph& CG);
134 
135 #if 0
136  EdgeArray<int> m_edgeStatus;
138 #endif
139 
147 #if 0
148  int m_genDebug; //only for debugging
149 #endif
150 };
151 
152 }
153 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::cluster_planarity::CPlanarSubClusteredST::initialize
void initialize(const ClusterGraph &CG)
Initializes some internally used members on CG.
ogdf::cluster_planarity::CPlanarSubClusteredST::constructRepresentationGraphEdges
void constructRepresentationGraphEdges(const ClusterGraph &CG, ClusterArray< Graph * > &RepGraph)
insert rep edges for all edges in clustergraph
Definition: CPlanarSubClusteredST.h:81
ogdf::cluster_planarity::CPlanarSubClusteredST::m_cRepNode
ClusterArray< node > m_cRepNode
store the representation nodes for nodes and clusters
Definition: CPlanarSubClusteredST.h:145
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:54
ogdf::ClusterGraph::constGraph
const Graph & constGraph() const
Returns a reference to the underlying graph.
Definition: ClusterGraph.h:797
ogdf::ClusterArrayBase
RegisteredArray for labeling the clusters of a ClusterGraph.
Definition: ClusterGraph.h:304
ogdf::cluster_planarity::CPlanarSubClusteredST
Constructs a c-planar subclustered spanning tree of the input by setting edgearray values.
Definition: CPlanarSubClusteredST.h:42
ogdf::cluster_planarity::CPlanarSubClusteredST::dfsBuildSpanningTree
void dfsBuildSpanningTree(node v, EdgeArray< bool > &treeEdges, NodeArray< bool > &visited)
ogdf::ClusterElement::children
ListContainer< cluster, ClusterElement > children
The container containing the child clusters (children in the cluster tree) of this cluster.
Definition: ClusterGraph.h:74
ogdf::ClusterElement
Representation of clusters in a clustered graph.
Definition: ClusterGraph.h:55
ogdf::ClusterGraph::clusters
internal::GraphObjectContainer< ClusterElement > clusters
The container containing all cluster objects.
Definition: ClusterGraph.h:377
ogdf::cluster_planarity::CPlanarSubClusteredST::m_vRepNode
NodeArray< node > m_vRepNode
Definition: CPlanarSubClusteredST.h:146
ogdf::cluster_planarity::CPlanarSubClusteredST::deleteRepresentationGraphs
void deleteRepresentationGraphs(const ClusterGraph &CG, ClusterArray< Graph * > &RepGraph)
Definition: CPlanarSubClusteredST.h:126
EdgeArray.h
Declaration and implementation of EdgeArray class.
ClusterArray.h
Declaration and implementation of ClusterArray class.
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::cluster_planarity::CPlanarSubClusteredST::constructRepresentationGraphNodes
void constructRepresentationGraphNodes(const ClusterGraph &CG, Graph &g, cluster c)
constructs for every cluster a graph representing its main structure (children & their connections) o...
Definition: CPlanarSubClusteredST.h:65
ogdf::ClusterGraph::commonClusterLastAncestors
cluster commonClusterLastAncestors(node v, node w, cluster &c1, cluster &c2) const
Returns the lowest common cluster lca and the highest ancestors on the path to lca.
Definition: ClusterGraph.h:626
ogdf::ClusterGraph::rootCluster
cluster rootCluster() const
Returns the root cluster.
Definition: ClusterGraph.h:433
ogdf::Graph::edges
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Definition: Graph_d.h:927
ogdf::cluster_planarity::CPlanarSubClusteredST::m_allocCluster
EdgeArray< cluster > m_allocCluster
store the allocation cluster to avoid multiple computation
Definition: CPlanarSubClusteredST.h:141
ogdf::Graph::newNode
node newNode(int index=-1)
Creates a new node and returns it.
Definition: Graph_d.h:1056
ogdf::cluster_planarity::CPlanarSubClusteredST::CPlanarSubClusteredST
CPlanarSubClusteredST()
Definition: CPlanarSubClusteredST.h:44
ogdf::cluster_planarity::CPlanarSubClusteredST::dfsBuildOriginalST
void dfsBuildOriginalST(node v, ClusterArray< EdgeArray< bool >> &treeEdges, EdgeArray< bool > &inST, NodeArray< bool > &visited)
builds spanning tree on original graph out of repgraphs STs
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
ClusterGraph.h
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
ogdf::cluster_planarity::CPlanarSubClusteredST::computeRepresentationGraphs
void computeRepresentationGraphs(const ClusterGraph &CG, ClusterArray< Graph * > &RepGraph)
Computes representation graphs used for spanning tree computation.
Definition: CPlanarSubClusteredST.h:118
ogdf::cluster_planarity::CPlanarSubClusteredST::m_repEdge
EdgeArray< edge > m_repEdge
store the representation edge
Definition: CPlanarSubClusteredST.h:143
ogdf::ListIteratorBase
Encapsulates a pointer to a list element.
Definition: List.h:46
ogdf::ClusterElement::nodes
ListContainer< node, ClusterElement > nodes
The container containing the nodes lying (directly) in this cluster.
Definition: ClusterGraph.h:71
ogdf::ClusterGraph
Representation of clustered graphs.
Definition: ClusterGraph.h:339
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::cluster_planarity::CPlanarSubClusteredST::call
virtual void call(const ClusterGraph &CG, EdgeArray< bool > &inST)
sets values in inST according to membership in c-planar STGraph
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709