Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

MinimumCut.h
Go to the documentation of this file.
1 
35 #pragma once
36 
37 #include <ogdf/basic/EdgeArray.h>
38 #include <ogdf/basic/NodeArray.h>
39 #include <ogdf/basic/GraphCopy.h>
41 
42 namespace ogdf {
43 
44 
46 
50 
51 public:
52  //Todo: Shift parameters to the call!
53  //m_minCut is only initialized once!!!
55  ~MinCut();
56 
57  // implements the main loop that computes the minimum cut by invoking function
58  // minimumCutPhase() in each iteration. Returns the mincut value.
59  double minimumCut();
60 
61  // returns the edges defining the computed mincut in list \p edges.
62  void cutEdges(List<edge> &edges, Graph &G);
63 
64  // returns list of nodes belonging to one side of the bipartition in list \p nodes.
65  void partition(List<node> &nodes);
66 
67  double minCutValue() const {return m_minCut;}
68 
69 private:
70 
71  // stores the value of the minimum cut
72  double m_minCut;
73 
74  // GraphCopy of the corresponding Graph. Used for the computation in order not
75  // to destroy the original Graph.
77 
78  // an EdgeArray containing the corresponding edge weights.
80 
81  // the two node lists corresponding to the node contraction
82  List<node> m_contraction1, m_contraction2;
83 
84  // store one side of the computed bipartition.
86 
87  // the list of edges defining the cut
89 
90  // each node has a list containing the nodes with which it has been contracted.
91  // Because the GraphCopy #m_GC is destroyed during the algorithm, this is
92  // necessary to be able to determine the original nodes in the end.
94 
95  // computes and returns the value of the minimum cut of the current phase (itertion).
96  double minimumCutPhase();
97 
98  // Contracts the nodes \p s and \p t, i.e \p s is collapsed to \p t.
99  // The edge (if existing) between \p s and \t s is deleted. Edges incident to \p s are redirected to \t.
100  // If parallel edges occur, one of them is deleted and its weight is added to the other one.
101  void contraction(node t, node s);
102 };
103 
104 }
double m_minCut
Definition: MinimumCut.h:72
List< node > m_partition
Definition: MinimumCut.h:85
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:492
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
GraphCopy m_GC
Definition: MinimumCut.h:76
Computes a minimum cut in a graph.
Definition: MinimumCut.h:49
List< node > m_contraction2
Definition: MinimumCut.h:82
Dynamic arrays indexed with nodes.
Definition: Graph_d.h:438
Declaration and implementation of EdgeArray class.
double minCutValue() const
Definition: MinimumCut.h:67
Declaration of graph copy classes.
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:249
Class for the representation of nodes.
Definition: Graph_d.h:169
Declaration and implementation of NodeArray class.
EdgeArray< double > m_w
Definition: MinimumCut.h:79
List< edge > m_cutEdges
Definition: MinimumCut.h:88
Declaration of simple graph algorithms.
The namespace for all OGDF objects.
NodeArray< List< node > > m_contractedNodes
Definition: MinimumCut.h:93