Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

GraphReduction.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <ogdf/basic/Graph.h>
36 #include <ogdf/basic/List.h>
37 #include <ogdf/basic/basic.h>
38 
39 namespace ogdf {
40 
41 
43 
49 protected:
50  const Graph* m_pGraph; // original graph
51  NodeArray<node> m_vOrig; // corresponding node in original graph
52  EdgeArray<List<edge>> m_eOrig; // corresponding edge in original graph
53 
54  NodeArray<node> m_vReduction; // corresponding node in graph copy
55  EdgeArray<edge> m_eReduction; // corresponding chain of edges in graph copy
56 
57  GraphReduction() : m_pGraph(nullptr) { }
58 
59 public:
60  // construction
61  explicit GraphReduction(const Graph& G);
62 
63  virtual ~GraphReduction() { }
64 
65  // returns original graph
66  const Graph& original() const { return *m_pGraph; }
67 
68  // returns original node
69  node original(node v) const { return m_vOrig[v]; }
70 
71  // returns original edges
72  const List<edge>& original(edge e) const { return m_eOrig[e]; }
73 
74  // returns reduction of node v (0 if none)
75  node reduction(node v) const { return m_vReduction[v]; }
76 
77  // returns reduction of edge e
78  edge reduction(edge e) const { return m_eReduction[e]; }
79 };
80 
81 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
Graph.h
Includes declaration of graph class.
ogdf::GraphReduction::~GraphReduction
virtual ~GraphReduction()
Definition: GraphReduction.h:63
ogdf::GraphReduction::GraphReduction
GraphReduction()
Definition: GraphReduction.h:57
ogdf::GraphReduction::m_vReduction
NodeArray< node > m_vReduction
Definition: GraphReduction.h:54
ogdf::GraphReduction::original
const List< edge > & original(edge e) const
Definition: GraphReduction.h:72
ogdf::GraphReduction::m_eReduction
EdgeArray< edge > m_eReduction
Definition: GraphReduction.h:55
ogdf::GraphReduction::m_vOrig
NodeArray< node > m_vOrig
Definition: GraphReduction.h:51
ogdf::GraphReduction::original
node original(node v) const
Definition: GraphReduction.h:69
ogdf::GraphReduction::m_eOrig
EdgeArray< List< edge > > m_eOrig
Definition: GraphReduction.h:52
ogdf::GraphReduction
Creates a reduced graph by removing leaves, self-loops, and reducing chains.
Definition: GraphReduction.h:48
ogdf::List< edge >
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::GraphReduction::reduction
edge reduction(edge e) const
Definition: GraphReduction.h:78
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::GraphReduction::m_pGraph
const Graph * m_pGraph
Definition: GraphReduction.h:50
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::GraphReduction::reduction
node reduction(node v) const
Definition: GraphReduction.h:75
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
List.h
Declaration of doubly linked lists and iterators.
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::GraphReduction::original
const Graph & original() const
Definition: GraphReduction.h:66
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716