Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
CPlanarSubClusteredST.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Graph.h>
36#include <ogdf/basic/List.h>
37#include <ogdf/basic/basic.h>
39
40namespace ogdf {
41namespace cluster_planarity {
42
45public:
47
49 virtual void call(const ClusterGraph& CG, EdgeArray<bool>& inST);
52 virtual void call(const ClusterGraph& CG, EdgeArray<bool>& inST, EdgeArray<double>& weight);
53
54private:
56 void dfsBuildOriginalST(/*ClusterGraph& CG,*/
57 node v,
58 ClusterArray<EdgeArray<bool>>& treeEdges, //edges in repgraph
59 EdgeArray<bool>& inST, //original edges
60 NodeArray<bool>& visited);
61 //builds spanning tree on graph of node v in treeEdges
63
68 // insert nodes for all child clusters
70 for (auto child : c->children) {
71 node v = g.newNode();
72 m_cRepNode[child] = v;
73 }
74 // insert nodes for all node entries in c
76 for (auto u : c->nodes) {
77 node v = g.newNode();
78 m_vRepNode[u] = v;
79 }
80 }
81
84 for (edge e : CG.constGraph().edges) {
85 //insert representation in RepGraph[allocation cluster]
86 //defined by lowest common ancestor of end points
87 node u = e->source();
88 node v = e->target();
89 cluster uAncestor, vAncestor;
90 cluster allocCluster = CG.commonClusterLastAncestors(u, v, uAncestor, vAncestor);
91 m_allocCluster[e] = allocCluster;
92 //now derive the real ancestors (maybe the nodes themselves from
93 //the supplied clusters
94
95 //Case1: both nodes in same cluster => connect the nodes in the
96 //cluster representation graph
97 if (uAncestor == vAncestor) {
98 m_repEdge[e] = RepGraph[uAncestor]->newEdge(m_vRepNode[u], m_vRepNode[v]);
99 } else {
100 OGDF_ASSERT(uAncestor != CG.rootCluster() || vAncestor != CG.rootCluster());
101 //now only one node can be directly in rootcluster
102 //this case now seems to fall together with else else...
103 if (uAncestor == CG.rootCluster()) {
104 m_repEdge[e] = RepGraph[uAncestor]->newEdge(m_vRepNode[u], m_cRepNode[vAncestor]);
105 } else if (vAncestor == CG.rootCluster()) {
106 m_repEdge[e] = RepGraph[vAncestor]->newEdge(m_cRepNode[uAncestor], m_vRepNode[v]);
107 } else {
108 OGDF_ASSERT(allocCluster != nullptr);
109 //now create edge in lowest common cluster
110 node v1, v2;
111 v1 = ((uAncestor == nullptr) ? m_vRepNode[u] : m_cRepNode[uAncestor]);
112 v2 = ((vAncestor == nullptr) ? m_vRepNode[v] : m_cRepNode[vAncestor]);
113 m_repEdge[e] = RepGraph[allocCluster]->newEdge(v1, v2);
114 }
115 }
116 }
117 }
118
121 for (cluster c : CG.clusters) {
122 RepGraph[c] = new Graph;
123 constructRepresentationGraphNodes(CG, *RepGraph[c], c);
124 }
126 }
127
129 for (cluster c : CG.clusters) {
130 delete RepGraph[c];
131 }
132 }
133
135 void initialize(const ClusterGraph& CG);
136
137#if 0
139 EdgeArray<int> m_edgeStatus;
140#endif
141
149#if 0
150 int m_genDebug; //only for debugging
151#endif
152};
153
154}
155}
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Declaration of doubly linked lists and iterators.
Basic declarations, included by all source files.
RegisteredArray for labeling the clusters of a ClusterGraph.
Representation of clusters in a clustered graph.
ListContainer< node, ClusterElement > nodes
The container containing the nodes lying (directly) in this cluster.
ListContainer< cluster, ClusterElement > children
The container containing the child clusters (children in the cluster tree) of this cluster.
Representation of clustered graphs.
cluster rootCluster() const
Returns the root cluster.
const Graph & constGraph() const
Returns a reference to the underlying graph.
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.
internal::GraphObjectContainer< ClusterElement > clusters
The container containing all cluster objects.
Class for the representation of edges.
Definition Graph_d.h:364
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
node newNode(int index=-1)
Creates a new node and returns it.
Definition Graph_d.h:1061
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Definition Graph_d.h:932
Encapsulates a pointer to a list element.
Definition List.h:113
Class for the representation of nodes.
Definition Graph_d.h:241
Constructs a c-planar subclustered spanning tree of the input by setting edgearray values.
void dfsBuildSpanningTree(node v, EdgeArray< bool > &treeEdges, NodeArray< bool > &visited)
void constructRepresentationGraphNodes(const ClusterGraph &CG, Graph &g, cluster c)
constructs for every cluster a graph representing its main structure (children & their connections) o...
EdgeArray< cluster > m_allocCluster
store the allocation cluster to avoid multiple computation
void deleteRepresentationGraphs(const ClusterGraph &CG, ClusterArray< Graph * > &RepGraph)
virtual void call(const ClusterGraph &CG, EdgeArray< bool > &inST)
sets values in inST according to membership in c-planar STGraph
void dfsBuildOriginalST(node v, ClusterArray< EdgeArray< bool > > &treeEdges, EdgeArray< bool > &inST, NodeArray< bool > &visited)
builds spanning tree on original graph out of repgraphs STs
EdgeArray< edge > m_repEdge
store the representation edge
virtual void call(const ClusterGraph &CG, EdgeArray< bool > &inST, EdgeArray< double > &weight)
sets values in inST according to membership in c-planar STGraph, computes minimum spanning tree accor...
void computeRepresentationGraphs(const ClusterGraph &CG, ClusterArray< Graph * > &RepGraph)
Computes representation graphs used for spanning tree computation.
void initialize(const ClusterGraph &CG)
Initializes some internally used members on CG.
void constructRepresentationGraphEdges(const ClusterGraph &CG, ClusterArray< Graph * > &RepGraph)
insert rep edges for all edges in clustergraph
ClusterArray< node > m_cRepNode
store the representation nodes for nodes and clusters
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:52
The namespace for all OGDF objects.