Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

CommonCompactionConstraintGraphBase.h
Go to the documentation of this file.
1 
32 #pragma once
33 
37 #include <ogdf/planarity/PlanRep.h>
38 
39 namespace ogdf {
40 
42 enum class ConstraintEdgeType {
43  BasicArc,
46  FixToZeroArc,
47  ReducibleArc,
48  MedianArc
49 };
50 
54 protected:
55  const OrthoRep *m_pOR;
56  const PlanRep *m_pPR;
57 
61 
64 
66 
71 
74 
76 
79 
80  virtual string getLengthString(edge e) const = 0;
81 
83  CommonCompactionConstraintGraphBase(const OrthoRep &OR, const PlanRep &PG, OrthoDir arcDir, int costAssoc);
84 
85 public:
88  const Graph &getGraph() const { return (const Graph&)*this; }
89  Graph &getGraph() { return (Graph&)*this; }
92 
94  const OrthoRep &getOrthoRep() const {
95  return *m_pOR;
96  }
97 
98  const PlanRep& getPlanRep() const {
99  return *m_pPR;
100  }
101 
104  const SListPure<node> &nodesIn(node v) const {
105  return m_path[v];
106  }
107 
110  node pathNodeOf(node v) const {
111  return m_pathNode[v];
112  }
113 
116  int cost(edge e) const {
117  return m_cost[e];
118  }
119 
121  node extraRep(node v) const {
122  return m_extraRep[v];
123  }
124 
126  bool onBorder(edge e) const {
127  return m_border[e] > 0;
128  }
129 
131  bool fixOnBorder(edge e) const {
132  return m_border[e] == 2;
133  }
134 
136 
138  void embed();
139 
141  edge basicArc(edge e) const {
142  return m_edgeToBasicArc[e];
143  }
144 
147 
151 
152 #ifdef OGDF_DEBUG
153 
160  void writeGML(const char *fileName) const;
162  void writeGML(std::ostream &os) const;
163  void writeGML(const char *fileName, const NodeArray<bool> &one) const;
164  void writeGML(std::ostream &os, const NodeArray<bool> &one) const;
166 
167 #endif
168 
175  return m_type[e];
176  }
177 
179  bool extraNode(node v) const {
180  return m_extraNode[v];
181  }
182 };
183 
184 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::CommonCompactionConstraintGraphBase::m_extraNode
NodeArray< bool > m_extraNode
Node does not represent drawing node as we dont have positions we save a drawing representant and an ...
Definition: CommonCompactionConstraintGraphBase.h:69
ogdf::CommonCompactionConstraintGraphBase::getOrthoRep
const OrthoRep & getOrthoRep() const
Returns underlying OrthoRep.
Definition: CommonCompactionConstraintGraphBase.h:94
ogdf::CommonCompactionConstraintGraphBase::m_oppArcDir
OrthoDir m_oppArcDir
Definition: CommonCompactionConstraintGraphBase.h:73
ogdf::CommonCompactionConstraintGraphBase::cost
int cost(edge e) const
Returns cost of edge e.
Definition: CommonCompactionConstraintGraphBase.h:116
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:59
ogdf::ConstraintEdgeType::BasicArc
@ BasicArc
ogdf::CommonCompactionConstraintGraphBase::basicArc
edge basicArc(edge e) const
Returns constraint arc representing input edge e in constraint graph.
Definition: CommonCompactionConstraintGraphBase.h:141
ogdf::CommonCompactionConstraintGraphBase::m_extraRep
NodeArray< node > m_extraRep
existing representant of extranodes position anchor
Definition: CommonCompactionConstraintGraphBase.h:70
ogdf::CommonCompactionConstraintGraphBase::m_path
NodeArray< SListPure< node > > m_path
list of nodes contained in a segment
Definition: CommonCompactionConstraintGraphBase.h:58
ogdf::CommonCompactionConstraintGraphBase::m_arcDir
OrthoDir m_arcDir
Definition: CommonCompactionConstraintGraphBase.h:72
ogdf::OrthoDir
OrthoDir
Definition: OrthoRep.h:51
ogdf::Tuple2
Tuples of two elements (2-tuples).
Definition: tuples.h:46
ogdf::CommonCompactionConstraintGraphBase::CommonCompactionConstraintGraphBase
CommonCompactionConstraintGraphBase(const OrthoRep &OR, const PlanRep &PG, OrthoDir arcDir, int costAssoc)
Build constraint graph with basic arcs.
ogdf::CommonCompactionConstraintGraphBase::m_originalEdge
NodeArray< edge > m_originalEdge
save edge for the basic arcs
Definition: CommonCompactionConstraintGraphBase.h:75
extended_graph_alg.h
Declaration of extended graph algorithms.
ogdf::CommonCompactionConstraintGraphBase::removeRedundantVisibArcs
void removeRedundantVisibArcs(SListPure< Tuple2< node, node >> &visibArcs)
Removes "arcs" from visibArcs which we already have in the constraint graph (as basic arcs)
ogdf::SList
Singly linked lists (maintaining the length of the list).
Definition: SList.h:773
ogdf::CommonCompactionConstraintGraphBase::extraNode
bool extraNode(node v) const
Returns node status.
Definition: CommonCompactionConstraintGraphBase.h:179
ogdf::NodeArray
Dynamic arrays indexed with nodes.
Definition: Graph_d.h:441
ogdf::EdgeArray
Dynamic arrays indexed with edges.
Definition: EdgeArray.h:112
PlanRep.h
Declaration of a base class for planar representations of graphs and cluster graphs.
ogdf::CommonCompactionConstraintGraphBase::m_border
EdgeArray< int > m_border
only used for cage precompaction in flowcompaction computecoords
Definition: CommonCompactionConstraintGraphBase.h:65
ogdf::CommonCompactionConstraintGraphBase::pathNodeOf
node pathNodeOf(node v) const
Returns the segment (path node in constraint graph) containing v.
Definition: CommonCompactionConstraintGraphBase.h:110
ogdf::CommonCompactionConstraintGraphBase::m_edgeToBasicArc
EdgeArray< edge > m_edgeToBasicArc
basic arc representing an edge in PG
Definition: CommonCompactionConstraintGraphBase.h:60
ogdf::CommonCompactionConstraintGraphBase::m_sinks
SList< node > m_sinks
Definition: CommonCompactionConstraintGraphBase.h:78
ogdf::CommonCompactionConstraintGraphBase::getGraph
const Graph & getGraph() const
Returns underlying graph.
Definition: CommonCompactionConstraintGraphBase.h:88
OrthoRep.h
Declaration of orthogonal representation of planar graphs.
ogdf::CommonCompactionConstraintGraphBase::embed
void embed()
Embeds constraint graph such that all sources and sinks lie in a common face.
ogdf::OrthoRep
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:236
ogdf::CommonCompactionConstraintGraphBase::m_pOR
const OrthoRep * m_pOR
Definition: CommonCompactionConstraintGraphBase.h:55
ogdf::ConstraintEdgeType::MedianArc
@ MedianArc
inserted to replace some reducible in fixzerolength
ogdf::CommonCompactionConstraintGraphBase::extraRep
node extraRep(node v) const
Returns extraNode existing anchor representant.
Definition: CommonCompactionConstraintGraphBase.h:121
ogdf::SListPure
Singly linked lists.
Definition: SList.h:38
ogdf::CommonCompactionConstraintGraphBase::computeTopologicalSegmentNum
void computeTopologicalSegmentNum(NodeArray< int > &topNum)
Computes topological numbering on the segments of the constraint graph.
ogdf::CommonCompactionConstraintGraphBase::getPlanRep
const PlanRep & getPlanRep() const
Definition: CommonCompactionConstraintGraphBase.h:98
ogdf::ConstraintEdgeType::VisibilityArc
@ VisibilityArc
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:495
ogdf::CommonCompactionConstraintGraphBase
A common base class for ogdf::GridCompactionConstraintGraphBase and ogdf::CompactionConstraintGraphBa...
Definition: CommonCompactionConstraintGraphBase.h:53
ogdf::ConstraintEdgeType::FixToZeroArc
@ FixToZeroArc
can be compacted to zero length, can be fixed
ogdf::CommonCompactionConstraintGraphBase::m_cost
EdgeArray< int > m_cost
cost of an edge
Definition: CommonCompactionConstraintGraphBase.h:62
ogdf::CommonCompactionConstraintGraphBase::onBorder
bool onBorder(edge e) const
Returns true if edge lies on cage border.
Definition: CommonCompactionConstraintGraphBase.h:126
ogdf::ConstraintEdgeType::ReducibleArc
@ ReducibleArc
can be compacted to zero length
ogdf::CommonCompactionConstraintGraphBase::m_pathNode
NodeArray< node > m_pathNode
segment containing a node in PG
Definition: CommonCompactionConstraintGraphBase.h:59
ogdf::CommonCompactionConstraintGraphBase::getLengthString
virtual string getLengthString(edge e) const =0
ogdf::ConstraintEdgeType
ConstraintEdgeType
Types of edges in the constraint graph.
Definition: CommonCompactionConstraintGraphBase.h:42
ogdf::CommonCompactionConstraintGraphBase::fixOnBorder
bool fixOnBorder(edge e) const
Returns true if edge is subject to length fixation if length < sep.
Definition: CommonCompactionConstraintGraphBase.h:131
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:292
ogdf::CommonCompactionConstraintGraphBase::getGraph
Graph & getGraph()
Definition: CommonCompactionConstraintGraphBase.h:89
ogdf::CommonCompactionConstraintGraphBase::typeOf
ConstraintEdgeType typeOf(edge e) const
Returns type of edge e.
Definition: CommonCompactionConstraintGraphBase.h:174
ogdf::CommonCompactionConstraintGraphBase::nodesIn
const SListPure< node > & nodesIn(node v) const
Returns list of nodes contained in segment v.
Definition: CommonCompactionConstraintGraphBase.h:104
ogdf::CommonCompactionConstraintGraphBase::m_pPR
const PlanRep * m_pPR
Definition: CommonCompactionConstraintGraphBase.h:56
ogdf::ConstraintEdgeType::VertexSizeArc
@ VertexSizeArc
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:169
simple_graph_alg.h
Declaration of simple graph algorithms.
ogdf::CommonCompactionConstraintGraphBase::m_type
EdgeArray< ConstraintEdgeType > m_type
constraint type for each edge
Definition: CommonCompactionConstraintGraphBase.h:63
ogdf::CommonCompactionConstraintGraphBase::m_sources
SList< node > m_sources
Definition: CommonCompactionConstraintGraphBase.h:77