Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
SimDraw.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Graph.h>
37#include <ogdf/basic/basic.h>
38
39#include <memory>
40#include <string>
41
42namespace ogdf {
43
45
57 friend class SimDrawCaller;
58 friend class SimDrawColorizer;
59 friend class SimDrawCreator;
61
62public:
64 enum class CompareBy {
65 index,
66 label
67 };
68
69private:
74
75
76public:
78
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
134
135#ifdef OGDF_DEBUG
137 void consistencyCheck() const;
138#endif
139
141
146 int maxSubGraph() const;
147
149
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
170
172
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
197private:
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}
Includes declaration of graph class.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Declaration of graph copy classes.
Basic declarations, included by all source files.
Stores additional attributes of a graph (like layout information).
const string & label(node v) const
Returns the label of node v.
void addAttributes(long attr)
Enables attributes specified by attr and allocates required memory.
bool has(long attr) const
Returns true iff all attributes in attr are available.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition Graph_d.h:979
virtual void clear()
Removes all nodes and all edges from the graph.
Class for the representation of nodes.
Definition Graph_d.h:241
int index() const
Returns the (unique) node index.
Definition Graph_d.h:275
Calls modified algorithms for simdraw instances.
Adds color to a graph.
Creates variety of possible SimDraw creations.
Offers predefined SimDraw creations.
The Base class for simultaneous graph drawing.
Definition SimDraw.h:55
std::unique_ptr< GraphCopy > getBasicGraph(int i) const
returns graph consisting of all edges and nodes from SubGraph i
int numberOfProperDummyNodes() const
returns number of proper dummy nodes
void readGML(const char *fileName)
calls GraphAttributes::readGML
int maxSubGraph() const
calculates maximum number of input graphs
CompareBy m_compareBy
compare mode
Definition SimDraw.h:72
CompareBy
Types for node comparison.
Definition SimDraw.h:64
bool addGraph(const Graph &G)
adds the graph g to the instance m_G
void addAttribute(long attr)
gives access to new attribute if not already given
Definition SimDraw.h:191
const Graph & constGraph() const
returns graph
Definition SimDraw.h:85
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
bool isProperDummy(node v) const
returns true if node v is a cost greater zero dummy node
void writeGML(const char *fileName) const
calls GraphAttributes::writeGML
bool compareById(node v, node w) const
compares two nodes v and w by their ids
Definition SimDraw.h:199
bool & isDummy(node v)
returns true if node v is marked as dummy
Definition SimDraw.h:117
int numberOfBasicGraphs() const
returns number of BasicGraphs in m_G
CompareBy & compareBy()
returns compare mode
Definition SimDraw.h:107
Graph m_G
the underlying graph
Definition SimDraw.h:70
GraphAttributes & constGraphAttributes()
returns graphattributes
Definition SimDraw.h:94
bool isPhantomDummy(node v) const
returns true if node v is a cost zero dummy node
Definition SimDraw.h:120
const CompareBy & compareBy() const
returns compare mode
Definition SimDraw.h:100
Graph & constGraph()
returns graph
Definition SimDraw.h:88
const GraphAttributes & constGraphAttributes() const
returns graphattributes
Definition SimDraw.h:91
void getBasicGraphAttributes(int i, GraphAttributes &GA, Graph &G)
returns graphattributes associated with basic graph i
GraphAttributes m_GA
the underlying graphattributes
Definition SimDraw.h:71
const bool & isDummy(node v) const
returns true if node v is marked as dummy
Definition SimDraw.h:114
bool addGraphAttributes(const GraphAttributes &GA)
adds new GraphAttributes to m_G
bool compare(const GraphAttributes &vGA, node v, const GraphAttributes &wGA, node w) const
compares two nodes v and w by compare mode stored in m_compareBy
NodeArray< bool > m_isDummy
dummy nodes may be colored differently
Definition SimDraw.h:73
int numberOfPhantomDummyNodes() const
returns number of phantom dummy nodes
int numberOfNodes() const
returns number of nodes
Definition SimDraw.h:126
SimDraw()
constructs empty simdraw instance
int numberOfDummyNodes() const
returns number of dummy nodes
void clear()
empty graph
Definition SimDraw.h:97
void consistencyCheck() const
Asserts that this SimDraw instance is consistent.
Interface for simdraw manipulators.
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
The namespace for all OGDF objects.