Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

SimDraw.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
36 #include <ogdf/basic/GraphCopy.h>
37 #include <ogdf/basic/basic.h>
38 
39 #include <memory>
40 #include <string>
41 
42 namespace ogdf {
43 
45 
57  friend class SimDrawCaller;
58  friend class SimDrawColorizer;
59  friend class SimDrawCreator;
60  friend class SimDrawCreatorSimple;
61 
62 public:
64  enum class CompareBy {
65  index,
66  label
67  };
68 
69 private:
74 
75 
76 public:
78 
82  SimDraw();
83 
85  const Graph& constGraph() const { return m_G; }
86 
88  Graph& constGraph() { return m_G; }
89 
91  const GraphAttributes& constGraphAttributes() const { return m_GA; }
92 
95 
97  void clear() { m_G.clear(); }
98 
100  const CompareBy& compareBy() const { return m_compareBy; }
101 
103  /*
104  * The usage of comparison by label makes only sense if the
105  * attribute nodeLabel is activated and labels are set properly.
106  */
107  CompareBy& compareBy() { return m_compareBy; }
108 
110 
114  const bool& isDummy(node v) const { return m_isDummy[v]; }
115 
117  bool& isDummy(node v) { return m_isDummy[v]; }
118 
120  bool isPhantomDummy(node v) const { return isDummy(v) && !isProperDummy(v); }
121 
123  bool isProperDummy(node v) const;
124 
126  int numberOfNodes() const { return m_G.numberOfNodes(); }
127 
129  int numberOfDummyNodes() const;
131  int numberOfPhantomDummyNodes() const;
133  int numberOfProperDummyNodes() const;
134 
135 #ifdef OGDF_DEBUG
136  void consistencyCheck() const;
138 #endif
139 
141 
146  int maxSubGraph() const;
147 
149 
154  int numberOfBasicGraphs() const;
155 
157  void readGML(const char* fileName);
159  void writeGML(const char* fileName) const;
160 
162  std::unique_ptr<GraphCopy> getBasicGraph(int i) const;
164 
169  void getBasicGraphAttributes(int i, GraphAttributes& GA, Graph& G);
170 
172 
179  bool addGraphAttributes(const GraphAttributes& GA);
180 
182 
188  bool addGraph(const Graph& G);
189 
191  void addAttribute(long attr) {
192  if (!m_GA.has(attr)) {
193  m_GA.addAttributes(attr);
194  }
195  }
196 
197 private:
199  bool compareById(node v, node w) const { return v->index() == w->index(); }
200 
202 
207  bool compareByLabel(const GraphAttributes& vGA, node v, const GraphAttributes& wGA, node w) const {
208  return vGA.label(v) == wGA.label(w);
209  }
210 
212 
216  bool compare(const GraphAttributes& vGA, node v, const GraphAttributes& wGA, node w) const;
217 };
218 
219 }
ogdf::SimDraw
The Base class for simultaneous graph drawing.
Definition: SimDraw.h:55
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
GraphAttributes.h
Declaration of class GraphAttributes which extends a Graph by additional attributes.
ogdf::SimDrawCreator
Creates variety of possible SimDraw creations.
Definition: SimDrawCreator.h:51
Graph.h
Includes declaration of graph class.
ogdf::NodeElement::index
int index() const
Returns the (unique) node index.
Definition: Graph_d.h:274
ogdf::SimDraw::constGraphAttributes
const GraphAttributes & constGraphAttributes() const
returns graphattributes
Definition: SimDraw.h:91
ogdf::SimDraw::isDummy
bool & isDummy(node v)
returns true if node v is marked as dummy
Definition: SimDraw.h:117
ogdf::SimDraw::compareById
bool compareById(node v, node w) const
compares two nodes v and w by their ids
Definition: SimDraw.h:199
ogdf::SimDrawCaller
Calls modified algorithms for simdraw instances.
Definition: SimDrawCaller.h:60
ogdf::SimDraw::compareBy
CompareBy & compareBy()
returns compare mode
Definition: SimDraw.h:107
ogdf::SimDraw::isPhantomDummy
bool isPhantomDummy(node v) const
returns true if node v is a cost zero dummy node
Definition: SimDraw.h:120
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:70
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:207
ogdf::Graph::numberOfNodes
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:982
ogdf::SimDraw::compareBy
const CompareBy & compareBy() const
returns compare mode
Definition: SimDraw.h:100
ogdf::SimDraw::m_GA
GraphAttributes m_GA
the underlying graphattributes
Definition: SimDraw.h:71
GraphCopy.h
Declaration of graph copy classes.
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::GraphAttributes::addAttributes
void addAttributes(long attr)
Enables attributes specified by attr and allocates required memory.
ogdf::SimDrawManipulatorModule
Interface for simdraw manipulators.
Definition: SimDrawManipulatorModule.h:62
ogdf::SimDraw::constGraphAttributes
GraphAttributes & constGraphAttributes()
returns graphattributes
Definition: SimDraw.h:94
ogdf::SimDraw::addAttribute
void addAttribute(long attr)
gives access to new attribute if not already given
Definition: SimDraw.h:191
ogdf::SimDrawColorizer
Adds color to a graph.
Definition: SimDrawColorizer.h:56
ogdf::SimDraw::m_isDummy
NodeArray< bool > m_isDummy
dummy nodes may be colored differently
Definition: SimDraw.h:73
ogdf::SimDraw::constGraph
const Graph & constGraph() const
returns graph
Definition: SimDraw.h:85
ogdf::SimDrawCreatorSimple
Offers predefined SimDraw creations.
Definition: SimDrawCreatorSimple.h:48
basic.h
Basic declarations, included by all source files.
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:97
ogdf::SimDraw::m_compareBy
CompareBy m_compareBy
compare mode
Definition: SimDraw.h:72
ogdf::SimDraw::numberOfNodes
int numberOfNodes() const
returns number of nodes
Definition: SimDraw.h:126
ogdf::SimDraw::constGraph
Graph & constGraph()
returns graph
Definition: SimDraw.h:88
ogdf::SimDraw::isDummy
const bool & isDummy(node v) const
returns true if node v is marked as dummy
Definition: SimDraw.h:114
ogdf::SimDraw::CompareBy
CompareBy
Types for node comparison.
Definition: SimDraw.h:64
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::GraphAttributes::label
const string & label(node v) const
Returns the label of node v.
Definition: GraphAttributes.h:555
ogdf::GraphAttributes::has
bool has(long attr) const
Returns true iff all attributes in attr are available.
Definition: GraphAttributes.h:200