Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

SimDraw.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 #include <ogdf/basic/GraphCopy.h>
36 
37 
38 namespace ogdf
39 {
40 
42 
53 {
55  friend class SimDrawCaller;
56  friend class SimDrawColorizer;
57  friend class SimDrawCreator;
58  friend class SimDrawCreatorSimple;
59 
60 public:
62  enum class CompareBy {
63  index,
64  label
65  };
66 
67 private:
72 
73 
74 public:
76 
80  SimDraw();
81 
82 
84  const Graph &constGraph() const { return m_G; }
86  Graph &constGraph() { return m_G; }
88  const GraphAttributes &constGraphAttributes() const { return m_GA; }
91 
93  void clear() { m_G.clear(); }
94 
96  const CompareBy &compareBy() const { return m_compareBy; }
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]; }
111  bool &isDummy(node v) { return m_isDummy[v]; }
113  bool isPhantomDummy(node v) const
114  {
115  return isDummy(v) && !isProperDummy(v);
116  }
118  bool isProperDummy(node v) const;
119 
121  int numberOfNodes() const { return m_G.numberOfNodes(); }
123  int numberOfDummyNodes() const;
125  int numberOfPhantomDummyNodes() const;
127  int numberOfProperDummyNodes() const;
128 
130  bool consistencyCheck() const;
131 
133 
138  int maxSubGraph() const;
139 
141 
146  int numberOfBasicGraphs() const;
147 
149  void readGML(const char *fileName);
151  void writeGML(const char *fileName) const;
152 
154  const Graph getBasicGraph(int i) const;
156 
161  void getBasicGraphAttributes(int i, GraphAttributes &GA, Graph &G);
162 
164 
171  bool addGraphAttributes(const GraphAttributes & GA);
172 
174 
180  bool addGraph(const Graph & G);
181 
183  void addAttribute(long attr)
184  {
185  if(!m_GA.has(attr))
186  m_GA.addAttributes(attr);
187  }
188 
189 private:
191  bool compareById(node v, node w) const { return v->index() == w->index(); }
192 
194 
199  bool compareByLabel(const GraphAttributes &vGA, node v, const GraphAttributes &wGA, node w) const
200  {
201  return vGA.label(v) == wGA.label(w);
202  }
203 
205 
209  bool compare(const GraphAttributes &vGA, node v,
210  const GraphAttributes &wGA, node w) const;
211 
212 };
213 
214 }
int numberOfNodes() const
returns number of nodes
Definition: SimDraw.h:121
Graph m_G
the underlying graph
Definition: SimDraw.h:68
Declaration of class GraphAttributes which extends a Graph by additional attributes.
virtual void clear()
Removes all nodes and all edges from the graph.
bool compareById(node v, node w) const
compares two nodes v and w by their ids
Definition: SimDraw.h:191
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
bool has(long attr) const
Returns true iff all attributes in attr are available.
void addAttributes(long attr)
Enables attributes specified by attr and allocates required memory.
const GraphAttributes & constGraphAttributes() const
returns graphattributes
Definition: SimDraw.h:88
void addAttribute(long attr)
gives access to new attribute if not already given
Definition: SimDraw.h:183
bool & isDummy(node v)
returns true if node v is marked as dummy
Definition: SimDraw.h:111
Graph & constGraph()
returns graph
Definition: SimDraw.h:86
CompareBy
Types for node comparison.
Definition: SimDraw.h:62
const string & label(node v) const
Returns the label of node v.
Stores additional attributes of a graph (like layout information).
Declaration of graph copy classes.
Adds color to a graph.
const bool & isDummy(node v) const
returns true if node v is marked as dummy
Definition: SimDraw.h:109
GraphAttributes & constGraphAttributes()
returns graphattributes
Definition: SimDraw.h:90
Class for the representation of nodes.
Definition: Graph_d.h:167
Calls modified algorithms for simdraw instances.
Definition: SimDrawCaller.h:56
NodeArray< bool > m_isDummy
dummy nodes may be colored differently
Definition: SimDraw.h:71
int index() const
Returns the (unique) node index.
Definition: Graph_d.h:201
GraphAttributes m_GA
the underlying graphattributes
Definition: SimDraw.h:69
CompareBy m_compareBy
compare mode
Definition: SimDraw.h:70
Creates variety of possible SimDraw creations.
const CompareBy & compareBy() const
returns compare mode
Definition: SimDraw.h:96
const Graph & constGraph() const
returns graph
Definition: SimDraw.h:84
CompareBy & compareBy()
returns compare mode
Definition: SimDraw.h:102
The Base class for simultaneous graph drawing.
Definition: SimDraw.h:52
bool isPhantomDummy(node v) const
returns true if node v is a cost zero dummy node
Definition: SimDraw.h:113
The namespace for all OGDF objects.
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:578
void clear()
empty graph
Definition: SimDraw.h:93
Offers predefined SimDraw creations.
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:199
Interface for simdraw manipulators.