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
40
41namespace ogdf {
42
44
48public:
50
51 virtual ~ClusterPlanRep() { }
52
53 void initCC(int i);
54
55 //edge on the cluster boundary, adjSource
56 void setClusterBoundary(edge e) { setEdgeTypeOf(e, edgeTypeOf(e) | clusterPattern()); }
57
59 return (edgeTypeOf(e) & clusterPattern()) == clusterPattern();
60 }
61
62 const ClusterGraph& getClusterGraph() const { return *m_pClusterGraph; }
63
75
77
78 //rootadj is set by ModelBoundaries
79 adjEntry externalAdj() { return m_rootAdj; }
80
81 //structural alterations
82
84 virtual void expand(bool lowDegreeExpand = false) override;
85
87
89 virtual edge split(edge e) override {
90 edge eNew = PlanRep::split(e);
91
92 //update edge to cluster info
93 m_edgeClusterID[eNew] = m_edgeClusterID[e];
94 m_nodeClusterID[eNew->source()] = m_edgeClusterID[e];
95
96 return eNew;
97 }
98
106 const auto sourceId = ClusterID(e->source());
107 const auto targetId = ClusterID(e->target());
108 cluster targetCluster = clusterOfIndex(targetId);
109
110 if (sourceId == targetId) {
111 return targetCluster;
112 }
113
114 cluster sourceCluster = clusterOfIndex(sourceId);
115
116 if (sourceCluster == targetCluster->parent()) {
117 return sourceCluster;
118 }
119 if (targetCluster == sourceCluster->parent()) {
120 return targetCluster;
121 }
122 if (targetCluster->parent() == sourceCluster->parent()) {
123 return sourceCluster->parent();
124 }
125
126 OGDF_ASSERT(false);
128 }
129
130 inline int ClusterID(node v) const { return m_nodeClusterID[v]; }
131
132 inline int ClusterID(edge e) const { return m_edgeClusterID[e]; }
133
135 OGDF_ASSERT(m_clusterOfIndex.isDefined(i));
136 return m_clusterOfIndex[i];
137 }
138
140 OGDF_ASSERT(!original(v));
141 OGDF_ASSERT(ClusterID(v) != -1);
142 return clusterOfIndex(ClusterID(v));
143 }
144
145 //output functions
146 void writeGML(const char* fileName, const Layout& drawing);
147 void writeGML(const char* fileName);
148 void writeGML(std::ostream& os, const Layout& drawing);
149
150protected:
154
157 bool clusterIsLeaf);
158
161
162private:
164
166 return UMLEdgeTypeConstants::SecCluster << UMLEdgeTypeOffsets::Secondary;
167 }
168
171
174 //we maintain an array of index to cluster mappings (CG is const)
175 //cluster numbers don't need to be consecutive
177};
178
179}
Declaration and implementation of ClusterArray class.
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
Declares ClusterGraphAttributes, an extension of class GraphAttributes, to store clustergraph layout ...
Declaration and implementation of HashArray class.
Declaration of a base class for planar representations of graphs and cluster graphs.
Class for adjacency list elements.
Definition Graph_d.h:79
Dynamic arrays indexed with adjacency entries.
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing.
Definition exceptions.h:241
Representation of clusters in a clustered graph.
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.
Dynamic arrays indexed with edges.
Definition EdgeArray.h:125
Class for the representation of edges.
Definition Graph_d.h:300
node target() const
Returns the target node of the edge.
Definition Graph_d.h:338
node source() const
Returns the source node of the edge.
Definition Graph_d.h:335
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:46
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
Orthogonal representation of an embedded graph.
Definition OrthoRep.h:219
Planarized representations (of a connected component) of a graph.
Definition PlanRep.h:57
Singly linked lists (maintaining the length of the list).
Definition SList.h:833
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
#define OGDF_THROW(CLASS)
Replacement for throw.
Definition exceptions.h:63
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:41
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
long long edgeType