Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ClusterPlanRep.h
Go to the documentation of this file.
1
33#pragma once
34
35#include <ogdf/basic/Graph.h>
37#include <ogdf/basic/SList.h>
38#include <ogdf/basic/basic.h>
43
44#include <iosfwd>
45
46namespace ogdf {
47class ClusterGraphAttributes;
48class CombinatorialEmbedding;
49class Layout;
50class OrthoRep;
51
53
57public:
58 ClusterPlanRep(const ClusterGraphAttributes& acGraph, const ClusterGraph& clusterGraph);
59
60 virtual ~ClusterPlanRep() { }
61
62 void initCC(int i);
63
64 //edge on the cluster boundary, adjSource
65 void setClusterBoundary(edge e) { setEdgeTypeOf(e, edgeTypeOf(e) | clusterPattern()); }
66
68 return (edgeTypeOf(e) & clusterPattern()) == clusterPattern();
69 }
70
71 const ClusterGraph& getClusterGraph() const { return *m_pClusterGraph; }
72
83 const SList<adjEntry>& crossedEdges);
84
86
87 //rootadj is set by ModelBoundaries
88 adjEntry externalAdj() { return m_rootAdj; }
89
90 //structural alterations
91
93 virtual void expand(bool lowDegreeExpand = false) override;
94
96
98 virtual edge split(edge e) override {
99 edge eNew = PlanRep::split(e);
100
101 //update edge to cluster info
102 m_edgeClusterID[eNew] = m_edgeClusterID[e];
103 m_nodeClusterID[eNew->source()] = m_edgeClusterID[e];
104
105 return eNew;
106 }
107
115 const auto sourceId = ClusterID(e->source());
116 const auto targetId = ClusterID(e->target());
117 cluster targetCluster = clusterOfIndex(targetId);
118
119 if (sourceId == targetId) {
120 return targetCluster;
121 }
122
123 cluster sourceCluster = clusterOfIndex(sourceId);
124
125 if (sourceCluster == targetCluster->parent()) {
126 return sourceCluster;
127 }
128 if (targetCluster == sourceCluster->parent()) {
129 return targetCluster;
130 }
131 if (targetCluster->parent() == sourceCluster->parent()) {
132 return sourceCluster->parent();
133 }
134
135 OGDF_ASSERT(false);
137 }
138
139 inline int ClusterID(node v) const { return m_nodeClusterID[v]; }
140
141 inline int ClusterID(edge e) const { return m_edgeClusterID[e]; }
142
144 OGDF_ASSERT(m_clusterOfIndex.isDefined(i));
145 return m_clusterOfIndex[i];
146 }
147
149 OGDF_ASSERT(!original(v));
150 OGDF_ASSERT(ClusterID(v) != -1);
151 return clusterOfIndex(ClusterID(v));
152 }
153
154 //output functions
155 void writeGML(const char* fileName, const Layout& drawing);
156 void writeGML(const char* fileName);
157 void writeGML(std::ostream& os, const Layout& drawing);
158
159protected:
162 AdjEntryArray<int>& outEdge);
163
166 bool clusterIsLeaf);
167
170
171private:
173
175 return UMLEdgeTypeConstants::SecCluster << UMLEdgeTypeOffsets::Secondary;
176 }
177
180
183 //we maintain an array of index to cluster mappings (CG is const)
184 //cluster numbers don't need to be consecutive
186};
187
188}
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
Edge types and patterns for planar representations.
Includes declaration of graph class.
Declaration and implementation of HashArray class.
Declaration of a base class for planar representations of graphs and cluster graphs.
Declaration of singly linked lists and iterators.
Basic declarations, included by all source files.
Class for adjacency list elements.
Definition Graph_d.h:143
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing.
Definition exceptions.h:247
Representation of clusters in a clustered graph.
cluster parent()
Returns the parent of the cluster.
Stores additional attributes of a clustered graph (like layout information).
Representation of clustered graphs.
Planarized representations for clustered graphs.
EdgeArray< int > m_edgeClusterID
bool isClusterBoundary(edge e)
void writeGML(std::ostream &os, const Layout &drawing)
cluster clusterOfDummy(node v)
int ClusterID(node v) const
void insertEdgePathEmbedded(edge eOrig, CombinatorialEmbedding &E, const SList< adjEntry > &crossedEdges)
re-inserts edge eOrig by "crossing" the edges in crossedEdges; splits each edge in crossedEdges Preco...
void writeGML(const char *fileName, const Layout &drawing)
virtual void expand(bool lowDegreeExpand=false) override
Expands nodes with degree > 4 and merge nodes for generalizations.
HashArray< int, cluster > m_clusterOfIndex
NodeArray< int > m_nodeClusterID
virtual void expandLowDegreeVertices(OrthoRep &OR)
cluster clusterOfIndex(int i)
void writeGML(const char *fileName)
void convertClusterGraph(cluster act, AdjEntryArray< edge > &currentEdge, AdjEntryArray< int > &outEdge)
Insert boundaries for all given clusters.
void setClusterBoundary(edge e)
ClusterPlanRep(const ClusterGraphAttributes &acGraph, const ClusterGraph &clusterGraph)
cluster clusterOfEdge(edge e)
Returns cluster of edge e.
const ClusterGraph & getClusterGraph() const
void reinsertEdge(edge e)
Reinserts edges to planarize the graph after convertClusterGraph.
adjEntry m_rootAdj
Connects cluster on highest level with non cluster or same level.
const ClusterGraph * m_pClusterGraph
void insertBoundary(cluster C, AdjEntryArray< edge > &currentEdge, AdjEntryArray< int > &outEdge, bool clusterIsLeaf)
Insert edges to represent the cluster boundary.
int ClusterID(edge e) const
virtual edge split(edge e) override
Splits edge e, updates clustercage lists if necessary and returns new edge.
Combinatorial embeddings of planar graphs with modification functionality.
Class for the representation of edges.
Definition Graph_d.h:364
node target() const
Returns the target node of the edge.
Definition Graph_d.h:402
node source() const
Returns the source node of the edge.
Definition Graph_d.h:399
Indexed arrays using hashing for element access.
Definition HashArray.h:93
Stores a layout of a graph (coordinates of nodes, bend points of edges).
Definition Layout.h:49
Class for the representation of nodes.
Definition Graph_d.h:241
Orthogonal representation of an embedded graph.
Definition OrthoRep.h:225
Planarized representations (of a connected component) of a graph.
Definition PlanRep.h:68
Singly linked lists (maintaining the length of the list).
Definition SList.h:845
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_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
Definition of exception classes.
#define OGDF_THROW(CLASS)
Replacement for throw.
Definition exceptions.h:67
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:52
The namespace for all OGDF objects.
long long edgeType