Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

SimDraw.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 #include <ogdf/basic/GraphCopy.h>
36 
37 namespace ogdf {
38 
40 
52  friend class SimDrawCaller;
53  friend class SimDrawColorizer;
54  friend class SimDrawCreator;
55  friend class SimDrawCreatorSimple;
56 
57 public:
59  enum class CompareBy {
60  index,
61  label
62  };
63 
64 private:
69 
70 
71 public:
73 
77  SimDraw();
78 
80  const Graph& constGraph() const { return m_G; }
81 
83  Graph& constGraph() { return m_G; }
84 
86  const GraphAttributes& constGraphAttributes() const { return m_GA; }
87 
90 
92  void clear() { m_G.clear(); }
93 
95  const CompareBy& compareBy() const { return m_compareBy; }
96 
98  /*
99  * The usage of comparison by label makes only sense if the
100  * attribute nodeLabel is activated and labels are set properly.
101  */
102  CompareBy& compareBy() { return m_compareBy; }
103 
105 
109  const bool& isDummy(node v) const { return m_isDummy[v]; }
110 
112  bool& isDummy(node v) { return m_isDummy[v]; }
113 
115  bool isPhantomDummy(node v) const { return isDummy(v) && !isProperDummy(v); }
116 
118  bool isProperDummy(node v) const;
119 
121  int numberOfNodes() const { return m_G.numberOfNodes(); }
122 
124  int numberOfDummyNodes() const;
126  int numberOfPhantomDummyNodes() const;
128  int numberOfProperDummyNodes() const;
129 
130 #ifdef OGDF_DEBUG
131  void consistencyCheck() const;
133 #endif
134 
136 
141  int maxSubGraph() const;
142 
144 
149  int numberOfBasicGraphs() const;
150 
152  void readGML(const char* fileName);
154  void writeGML(const char* fileName) const;
155 
157  std::unique_ptr<GraphCopy> getBasicGraph(int i) const;
159 
164  void getBasicGraphAttributes(int i, GraphAttributes& GA, Graph& G);
165 
167 
174  bool addGraphAttributes(const GraphAttributes& GA);
175 
177 
183  bool addGraph(const Graph& G);
184 
186  void addAttribute(long attr) {
187  if (!m_GA.has(attr)) {
188  m_GA.addAttributes(attr);
189  }
190  }
191 
192 private:
194  bool compareById(node v, node w) const { return v->index() == w->index(); }
195 
197 
202  bool compareByLabel(const GraphAttributes& vGA, node v, const GraphAttributes& wGA, node w) const {
203  return vGA.label(v) == wGA.label(w);
204  }
205 
207 
211  bool compare(const GraphAttributes& vGA, node v, const GraphAttributes& wGA, node w) const;
212 };
213 
214 }
ogdf::SimDraw
The Base class for simultaneous graph drawing.
Definition: SimDraw.h:50
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:66
GraphAttributes.h
Declaration of class GraphAttributes which extends a Graph by additional attributes.
ogdf::SimDrawCreator
Creates variety of possible SimDraw creations.
Definition: SimDrawCreator.h:44
ogdf::NodeElement::index
int index() const
Returns the (unique) node index.
Definition: Graph_d.h:267
ogdf::SimDraw::constGraphAttributes
const GraphAttributes & constGraphAttributes() const
returns graphattributes
Definition: SimDraw.h:86
ogdf::SimDraw::isDummy
bool & isDummy(node v)
returns true if node v is marked as dummy
Definition: SimDraw.h:112
ogdf::SimDraw::compareById
bool compareById(node v, node w) const
compares two nodes v and w by their ids
Definition: SimDraw.h:194
ogdf::SimDrawCaller
Calls modified algorithms for simdraw instances.
Definition: SimDrawCaller.h:55
ogdf::SimDraw::compareBy
CompareBy & compareBy()
returns compare mode
Definition: SimDraw.h:102
ogdf::SimDraw::isPhantomDummy
bool isPhantomDummy(node v) const
returns true if node v is a cost zero dummy node
Definition: SimDraw.h:115
ogdf::Graph::clear
virtual void clear()
Removes all nodes and all edges from the graph.
ogdf::SimDraw::m_G
Graph m_G
the underlying graph
Definition: SimDraw.h:65
ogdf::SimDraw::compareByLabel
bool compareByLabel(const GraphAttributes &vGA, node v, const GraphAttributes &wGA, node w) const
compares two nodes v and w by their labels
Definition: SimDraw.h:202
ogdf::Graph::numberOfNodes
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:974
ogdf::SimDraw::compareBy
const CompareBy & compareBy() const
returns compare mode
Definition: SimDraw.h:95
ogdf::SimDraw::m_GA
GraphAttributes m_GA
the underlying graphattributes
Definition: SimDraw.h:66
GraphCopy.h
Declaration of graph copy classes.
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
ogdf::GraphAttributes::addAttributes
void addAttributes(long attr)
Enables attributes specified by attr and allocates required memory.
ogdf::SimDrawManipulatorModule
Interface for simdraw manipulators.
Definition: SimDrawManipulatorModule.h:58
ogdf::SimDraw::constGraphAttributes
GraphAttributes & constGraphAttributes()
returns graphattributes
Definition: SimDraw.h:89
ogdf::SimDraw::addAttribute
void addAttribute(long attr)
gives access to new attribute if not already given
Definition: SimDraw.h:186
ogdf::SimDrawColorizer
Adds color to a graph.
Definition: SimDrawColorizer.h:53
ogdf::SimDraw::m_isDummy
NodeArray< bool > m_isDummy
dummy nodes may be colored differently
Definition: SimDraw.h:68
ogdf::SimDraw::constGraph
const Graph & constGraph() const
returns graph
Definition: SimDraw.h:80
ogdf::SimDrawCreatorSimple
Offers predefined SimDraw creations.
Definition: SimDrawCreatorSimple.h:45
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::SimDraw::clear
void clear()
empty graph
Definition: SimDraw.h:92
ogdf::SimDraw::m_compareBy
CompareBy m_compareBy
compare mode
Definition: SimDraw.h:67
ogdf::SimDraw::numberOfNodes
int numberOfNodes() const
returns number of nodes
Definition: SimDraw.h:121
ogdf::SimDraw::constGraph
Graph & constGraph()
returns graph
Definition: SimDraw.h:83
ogdf::SimDraw::isDummy
const bool & isDummy(node v) const
returns true if node v is marked as dummy
Definition: SimDraw.h:109
ogdf::SimDraw::CompareBy
CompareBy
Types for node comparison.
Definition: SimDraw.h:59
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::GraphAttributes::label
const string & label(node v) const
Returns the label of node v.
Definition: GraphAttributes.h:549
ogdf::GraphAttributes::has
bool has(long attr) const
Returns true iff all attributes in attr are available.
Definition: GraphAttributes.h:194