Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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