Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

ClusterPlanRep.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <ogdf/planarity/PlanRep.h>
39 
40 #include <ogdf/basic/HashArray.h>
41 
42 
43 namespace ogdf {
44 
46 
50 {
51 public:
53  const ClusterGraphAttributes &acGraph,
54  const ClusterGraph &clusterGraph);
55 
56  virtual ~ClusterPlanRep() { }
57 
58  void initCC(int i);
59 
60  //edge on the cluster boundary, adjSource
62  setEdgeTypeOf(e, edgeTypeOf(e) | clusterPattern());
63  }
65  return (edgeTypeOf(e) & clusterPattern()) == clusterPattern();
66  }
67  const ClusterGraph &getClusterGraph() const {
68  return *m_pClusterGraph;
69  }
70 
80  void insertEdgePathEmbedded(
81  edge eOrig,
83  const SList<adjEntry> &crossedEdges);
84 
85  void ModelBoundaries();
86 
87  //rootadj is set by ModelBoundaries
88  adjEntry externalAdj() { return m_rootAdj; }
89 
90 
91  //structural alterations
92 
94  virtual void expand(bool lowDegreeExpand = false) override;
95 
96  virtual void expandLowDegreeVertices(OrthoRep &OR);
97 
99  virtual edge split(edge e) override
100  {
101  edge eNew = PlanRep::split(e);
102 
103  //update edge to cluster info
104  m_edgeClusterID[eNew] = m_edgeClusterID[e];
105  m_nodeClusterID[eNew->source()] = m_edgeClusterID[e];
106 
107  return eNew;
108  }
109 
117  {
118  const auto sourceId = ClusterID(e->source());
119  const auto targetId = ClusterID(e->target());
120  cluster targetCluster = clusterOfIndex(targetId);
121 
122  if (sourceId == targetId)
123  return targetCluster;
124 
125  cluster sourceCluster = clusterOfIndex(sourceId);
126 
127  if (sourceCluster == targetCluster->parent())
128  return sourceCluster;
129  if (targetCluster == sourceCluster->parent())
130  return targetCluster;
131  if (targetCluster->parent() == sourceCluster->parent())
132  return sourceCluster->parent();
133 
134  OGDF_ASSERT(false);
136  }
137 
138  inline int ClusterID(node v) const {return m_nodeClusterID[v];}
139  inline int ClusterID(edge e) const {return m_edgeClusterID[e];}
141  OGDF_ASSERT(m_clusterOfIndex.isDefined(i));
142  return m_clusterOfIndex[i];
143  }
144 
146  {
147  OGDF_ASSERT(!original(v));
148  OGDF_ASSERT(ClusterID(v) != -1);
149  return clusterOfIndex(ClusterID(v));
150  }
151 
152  //output functions
153  void writeGML(const char *fileName, const Layout &drawing);
154  void writeGML(const char *fileName);
155  void writeGML(std::ostream &os, const Layout &drawing);
156 
157 protected:
159  void convertClusterGraph(cluster act,
160  AdjEntryArray<edge>& currentEdge,
161  AdjEntryArray<int>& outEdge);
162 
164  void insertBoundary(cluster C,
165  AdjEntryArray<edge>& currentEdge,
166  AdjEntryArray<int>& outEdge,
167  bool clusterIsLeaf);
168 
170  void reinsertEdge(edge e);
171 
172 private:
174 
176 
179 
182  //we maintain an array of index to cluster mappings (CG is const)
183  //cluster numbers don't need to be consecutive
185 };
186 
187 }
node target() const
Returns the target node of the edge.
Definition: Graph_d.h:328
EdgeArray< int > m_edgeClusterID
cluster clusterOfIndex(int i)
Declaration and implementation of HashArray class.
Derived class of GraphObserver providing additional functionality to handle clustered graphs...
void setClusterBoundary(edge e)
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
cluster clusterOfEdge(edge e)
Returns cluster of edge e.
cluster parent()
Returns the parent of the cluster.
Definition: ClusterGraph.h:150
#define OGDF_THROW(CLASS)
Replacement for throw.
Definition: exceptions.h:65
Indexed arrays using hashing for element access.
Definition: HashArray.h:94
bool isClusterBoundary(edge e)
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:236
Declaration of a base class for planar representations of graphs and cluster graphs.
Dynamic arrays indexed with adjacency entries.
Singly linked lists (maintaining the length of the list).
Definition: SList.h:773
int ClusterID(node v) const
const ClusterGraph * m_pClusterGraph
Representation of clustered graphs.
Definition: ClusterGraph.h:291
int ClusterID(edge e) const
const ClusterGraph & getClusterGraph() const
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing...
Definition: exceptions.h:253
Class for the representation of edges.
Definition: Graph_d.h:292
adjEntry m_rootAdj
Connects cluster on highest level with non cluster or same level.
Stores additional attributes of a clustered graph (like layout information).
Planarized representations for clustered graphs.
virtual edge split(edge e) override
Splits edge e, updates clustercage lists if necessary and returns new edge.
Class for the representation of nodes.
Definition: Graph_d.h:169
cluster clusterOfDummy(node v)
virtual edge split(edge e) override
Splits edge e.
Declares ClusterGraphAttributes, an extension of class GraphAttributes, to store clustergraph layout ...
Representation of clusters in a clustered graph.
Definition: ClusterGraph.h:53
NodeArray< int > m_nodeClusterID
HashArray< int, cluster > m_clusterOfIndex
node source() const
Returns the source node of the edge.
Definition: Graph_d.h:326
Declaration and implementation of ClusterArray class.
The namespace for all OGDF objects.
long long edgeType
Combinatorial embeddings of planar graphs with modification functionality.
Class for adjacency list elements.
Definition: Graph_d.h:79
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:41
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:59
Stores a layout of a graph (coordinates of nodes, bend points of edges).
Definition: Layout.h:46