Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

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  }//split
109 
110 
118  {
119  const auto sourceId = ClusterID(e->source());
120  const auto targetId = ClusterID(e->target());
121  cluster targetCluster = clusterOfIndex(targetId);
122 
123  if (sourceId == targetId)
124  return targetCluster;
125 
126  cluster sourceCluster = clusterOfIndex(sourceId);
127 
128  if (sourceCluster == targetCluster->parent())
129  return sourceCluster;
130  if (targetCluster == sourceCluster->parent())
131  return targetCluster;
132  if (targetCluster->parent() == sourceCluster->parent())
133  return sourceCluster->parent();
134 
135  OGDF_ASSERT(false);
137  }//clusterOfEdge
138 
139  inline int ClusterID(node v) const {return m_nodeClusterID[v];}
140  inline int ClusterID(edge e) const {return m_edgeClusterID[e];}
142  OGDF_ASSERT(m_clusterOfIndex.isDefined(i));
143  return m_clusterOfIndex[i];
144  }
145 
147  {
148  OGDF_ASSERT(!original(v));
149  OGDF_ASSERT(ClusterID(v) != -1);
150  return clusterOfIndex(ClusterID(v));
151  }
152 
153  //output functions
154  void writeGML(const char *fileName, const Layout &drawing);
155  void writeGML(const char *fileName);
156  void writeGML(ostream &os, const Layout &drawing);
157 
158 protected:
160  void convertClusterGraph(cluster act,
161  AdjEntryArray<edge>& currentEdge,
162  AdjEntryArray<int>& outEdge);
163 
165  void insertBoundary(cluster C,
166  AdjEntryArray<edge>& currentEdge,
167  AdjEntryArray<int>& outEdge,
168  bool clusterIsLeaf);
169 
171  void reinsertEdge(edge e);
172 
173 private:
175 
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 }
node target() const
Returns the target node of the edge.
Definition: Graph_d.h:327
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:60
Indexed arrays using hashing for element access.
Definition: HashArray.h:94
bool isClusterBoundary(edge e)
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:237
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:777
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:308
Class for the representation of edges.
Definition: Graph_d.h:291
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:167
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:325
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:78
#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:60
Stores a layout of a graph (coordinates of nodes, bend points of edges).
Definition: Layout.h:46