Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ConnectivityTester.h
Go to the documentation of this file.
1
32#pragma once
33
37
38namespace ogdf {
39
50private:
57 const Graph* m_graph;
58
66 void prepareGraph(const Graph& graph);
67
75
85
91 void duplicateEdges(Graph& graph);
92
99 void restrictNodes(Graph& graph);
100
108 node copyOf(node v, bool isSource = false) const;
109
110public:
117 explicit ConnectivityTester(bool nodeConnectivity = true, bool directed = false)
119 m_usingDefaultMaxFlow = true;
120 }
121
130 bool directed = false)
131 : m_flowAlgo(flowAlgo)
132 , m_source(nullptr)
133 , m_usingDefaultMaxFlow(false)
134 , m_graphCopied(false)
135 , m_nodeConnectivity(nodeConnectivity)
136 , m_directed(directed)
137 , m_graph(nullptr) { }
138
143 if (m_usingDefaultMaxFlow) {
144 delete m_flowAlgo;
145 }
146
147 if (m_graphCopied) {
148 delete m_graph;
149 }
150
151 delete m_source;
152 }
153
163 int computeConnectivity(const Graph& graph, node v, node u) {
164 prepareGraph(graph);
165
166 return computeConnectivity(copyOf(v, true), copyOf(u));
167 }
168
178 int computeConnectivity(const Graph& graph, NodeArray<NodeArray<int>>& result) {
179 prepareGraph(graph);
180
181 return computeConnectivity(result);
182 }
183};
184
185}
Declaration of graph copy classes.
Declaration and implementation of Goldberg-Tarjan max-flow algorithm with global relabeling and gap r...
Interface for Max Flow Algorithms.
Naive implementation for testing the connectivity of a graph.
int computeConnectivity(const Graph &graph, node v, node u)
Computes the connectivity of two nodes.
int computeConnectivity(NodeArray< NodeArray< int > > &result)
Computes the connectivity of all nodes of the transformed graph.
~ConnectivityTester()
Destroys the connectivity tester and frees allocated memory.
ConnectivityTester(bool nodeConnectivity=true, bool directed=false)
Initializes a new connectivity tester using ogdf::MaxFlowGoldbergTarjan.
ConnectivityTester(MaxFlowModule< int > *flowAlgo, bool nodeConnectivity=true, bool directed=false)
Initializes a new onnectivity tester using a custom ogdf::MaxFlowModule.
void restrictNodes(Graph &graph)
Restricts the flow through each node to 1.
MaxFlowModule< int > * m_flowAlgo
void prepareGraph(const Graph &graph)
Prepares the graph.
void duplicateEdges(Graph &graph)
Makes the graph bi-directed.
node copyOf(node v, bool isSource=false) const
Retuns the node of the transformed graph corresponding to node v.
int computeConnectivity(const Graph &graph, NodeArray< NodeArray< int > > &result)
Computes the connectivity of all nodes of the provided graph.
NodeArray< node > * m_source
int computeConnectivity(node v, node u)
Computes the connectivity of two nodes of the transformed graph.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Computes a max flow via Preflow-Push (global relabeling and gap relabeling heuristic).
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.