Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

CommonCompactionConstraintGraphBase.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
35 #include <ogdf/basic/SList.h>
36 #include <ogdf/basic/basic.h>
37 
38 #include <iosfwd>
39 #include <string>
40 
41 namespace ogdf {
42 class OrthoRep;
43 class PlanRep;
44 enum class OrthoDir;
45 template<class E1, class E2>
46 class Tuple2;
47 
49 enum class ConstraintEdgeType {
50  BasicArc,
53  FixToZeroArc,
54  ReducibleArc,
55  MedianArc
56 };
57 
60 protected:
61  const OrthoRep* m_pOR;
62  const PlanRep* m_pPR;
63 
67 
70 
72 
77 
80 
82 
85 
86  virtual string getLengthString(edge e) const = 0;
87 
89  CommonCompactionConstraintGraphBase(const OrthoRep& OR, const PlanRep& PG, OrthoDir arcDir,
90  int costAssoc);
91 
92 public:
95  const Graph& getGraph() const { return (const Graph&)*this; }
96 
97  Graph& getGraph() { return (Graph&)*this; }
98 
101 
103  const OrthoRep& getOrthoRep() const { return *m_pOR; }
104 
105  const PlanRep& getPlanRep() const { return *m_pPR; }
106 
109  const SListPure<node>& nodesIn(node v) const { return m_path[v]; }
110 
113  node pathNodeOf(node v) const { return m_pathNode[v]; }
114 
117  int cost(edge e) const { return m_cost[e]; }
118 
120  node extraRep(node v) const { return m_extraRep[v]; }
121 
123  bool onBorder(edge e) const { return m_border[e] > 0; }
124 
126  bool fixOnBorder(edge e) const { return m_border[e] == 2; }
127 
129 
131  void embed();
132 
134  edge basicArc(edge e) const { return m_edgeToBasicArc[e]; }
135 
138 
142 
143 #ifdef OGDF_DEBUG
144 
151  void writeGML(const char* fileName) const;
153  void writeGML(std::ostream& os) const;
154  void writeGML(const char* fileName, const NodeArray<bool>& one) const;
155  void writeGML(std::ostream& os, const NodeArray<bool>& one) const;
157 
158 #endif
159 
165  ConstraintEdgeType typeOf(edge e) const { return m_type[e]; }
166 
168  bool extraNode(node v) const { return m_extraNode[v]; }
169 };
170 
171 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
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:75
ogdf::CommonCompactionConstraintGraphBase::getOrthoRep
const OrthoRep & getOrthoRep() const
Returns underlying OrthoRep.
Definition: CommonCompactionConstraintGraphBase.h:103
Graph.h
Includes declaration of graph class.
ogdf::CommonCompactionConstraintGraphBase::m_oppArcDir
OrthoDir m_oppArcDir
Definition: CommonCompactionConstraintGraphBase.h:79
ogdf::CommonCompactionConstraintGraphBase::cost
int cost(edge e) const
Returns cost of edge e.
Definition: CommonCompactionConstraintGraphBase.h:117
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:69
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:134
ogdf::CommonCompactionConstraintGraphBase::m_extraRep
NodeArray< node > m_extraRep
existing representant of extranodes position anchor
Definition: CommonCompactionConstraintGraphBase.h:76
ogdf::CommonCompactionConstraintGraphBase::m_path
NodeArray< SListPure< node > > m_path
list of nodes contained in a segment
Definition: CommonCompactionConstraintGraphBase.h:64
ogdf::CommonCompactionConstraintGraphBase::m_arcDir
OrthoDir m_arcDir
Definition: CommonCompactionConstraintGraphBase.h:78
ogdf::OrthoDir
OrthoDir
Definition: OrthoRep.h:56
ogdf::Tuple2
Tuples of two elements (2-tuples).
Definition: tuples.h:49
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:81
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:845
ogdf::CommonCompactionConstraintGraphBase::extraNode
bool extraNode(node v) const
Returns node status.
Definition: CommonCompactionConstraintGraphBase.h:168
ogdf::CommonCompactionConstraintGraphBase::m_border
EdgeArray< int > m_border
only used for cage precompaction in flowcompaction computecoords
Definition: CommonCompactionConstraintGraphBase.h:71
ogdf::CommonCompactionConstraintGraphBase::pathNodeOf
node pathNodeOf(node v) const
Returns the segment (path node in constraint graph) containing v.
Definition: CommonCompactionConstraintGraphBase.h:113
ogdf::CommonCompactionConstraintGraphBase::writeGML
void writeGML(const char *fileName) const
Writes GML output (for debugging)
ogdf::CommonCompactionConstraintGraphBase::m_edgeToBasicArc
EdgeArray< edge > m_edgeToBasicArc
basic arc representing an edge in PG
Definition: CommonCompactionConstraintGraphBase.h:66
ogdf::CommonCompactionConstraintGraphBase::m_sinks
SList< node > m_sinks
Definition: CommonCompactionConstraintGraphBase.h:84
ogdf::CommonCompactionConstraintGraphBase::getGraph
const Graph & getGraph() const
Returns underlying graph.
Definition: CommonCompactionConstraintGraphBase.h:95
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:225
SList.h
Declaration of singly linked lists and iterators.
ogdf::CommonCompactionConstraintGraphBase::m_pOR
const OrthoRep * m_pOR
Definition: CommonCompactionConstraintGraphBase.h:61
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:120
ogdf::SListPure
Singly linked lists.
Definition: SList.h:52
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:105
ogdf::ConstraintEdgeType::VisibilityArc
@ VisibilityArc
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::CommonCompactionConstraintGraphBase
Base class for ogdf::CompactionConstraintGraphBase.
Definition: CommonCompactionConstraintGraphBase.h:59
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:68
ogdf::CommonCompactionConstraintGraphBase::onBorder
bool onBorder(edge e) const
Returns true if edge lies on cage border.
Definition: CommonCompactionConstraintGraphBase.h:123
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:65
basic.h
Basic declarations, included by all source files.
ogdf::CommonCompactionConstraintGraphBase::getLengthString
virtual string getLengthString(edge e) const =0
ogdf::ConstraintEdgeType
ConstraintEdgeType
Types of edges in the constraint graph.
Definition: CommonCompactionConstraintGraphBase.h:49
ogdf::CommonCompactionConstraintGraphBase::fixOnBorder
bool fixOnBorder(edge e) const
Returns true if edge is subject to length fixation if length < sep.
Definition: CommonCompactionConstraintGraphBase.h:126
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ogdf::CommonCompactionConstraintGraphBase::getGraph
Graph & getGraph()
Definition: CommonCompactionConstraintGraphBase.h:97
ogdf::CommonCompactionConstraintGraphBase::typeOf
ConstraintEdgeType typeOf(edge e) const
Returns type of edge e.
Definition: CommonCompactionConstraintGraphBase.h:165
ogdf::CommonCompactionConstraintGraphBase::nodesIn
const SListPure< node > & nodesIn(node v) const
Returns list of nodes contained in segment v.
Definition: CommonCompactionConstraintGraphBase.h:109
ogdf::CommonCompactionConstraintGraphBase::m_pPR
const PlanRep * m_pPR
Definition: CommonCompactionConstraintGraphBase.h:62
ogdf::ConstraintEdgeType::VertexSizeArc
@ VertexSizeArc
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716
ogdf::CommonCompactionConstraintGraphBase::m_type
EdgeArray< ConstraintEdgeType > m_type
constraint type for each edge
Definition: CommonCompactionConstraintGraphBase.h:69
ogdf::CommonCompactionConstraintGraphBase::m_sources
SList< node > m_sources
Definition: CommonCompactionConstraintGraphBase.h:83