Computes a minimum cut in a graph. More...
#include <ogdf/graphalg/MinimumCutStoerWagner.h>
Public Member Functions | |
virtual T | call (const Graph &G) override |
Computes a minimum cut on graph G . | |
virtual T | call (const Graph &G, const EdgeArray< T > &weights) override |
Computes a minimum cut on graph G with non-negative weights on edges. | |
virtual const ArrayBuffer< edge > & | edges () override |
Computes the edges defining the computed mincut and returns them. | |
virtual const ArrayBuffer< node > & | nodes () override |
Returns a const-reference to the list of nodes belonging to one side of the bipartition. | |
virtual T | value () const override |
Returns the value of the last minimum cut computation. | |
Public Member Functions inherited from ogdf::MinimumCutModule< T > | |
virtual | ~MinimumCutModule () |
Do nothing on destruction. | |
Protected Member Functions | |
void | contraction (node t, node s) |
Contracts the nodes s and t , i.e., s is collapsed to t . The edge (if existing) between s and t is deleted. Edges incident to s are redirected to t . If parallel edges occur, one of them is deleted and its weight is added to the other one. | |
void | mainLoop () |
Computes minimum cut by invoking minimumCutPhase() O(|V|) times. | |
T | minimumCutPhase () |
Computes and returns the value of the minimum cut of the current phase (iteration). | |
Protected Attributes | |
NodeArray< List< node > > | m_contractedNodes |
Each node has a list containing the nodes with which it has been contracted. Because the GraphCopy m_GC is destroyed during the algorithm, this is necessary to be able to determine the original nodes in the end. | |
ArrayBuffer< edge > | m_cutEdges |
Store cut edges if computed. | |
GraphCopy | m_GC |
The modifiable version of the input graph (used for contractions) | |
T | m_minCut |
Stores the value of the minimum cut. | |
ArrayBuffer< node > | m_partition |
Store one side of the computed bipartition. | |
EdgeArray< T > | m_w |
An EdgeArray containing the corresponding edge weights. | |
Computes a minimum cut in a graph.
The minimum-cut algorithm according to an approach of Stoer and Wagner 1997 is used.
Definition at line 50 of file MinimumCutStoerWagner.h.
|
inlineoverridevirtual |
Computes a minimum cut on graph G
.
Implements ogdf::MinimumCutModule< T >.
Definition at line 52 of file MinimumCutStoerWagner.h.
|
inlineoverridevirtual |
Computes a minimum cut on graph G
with non-negative weights
on edges.
Implements ogdf::MinimumCutModule< T >.
Definition at line 58 of file MinimumCutStoerWagner.h.
|
protected |
Contracts the nodes s
and t
, i.e., s
is collapsed to t
. The edge (if existing) between s
and t
is deleted. Edges incident to s
are redirected to t
. If parallel edges occur, one of them is deleted and its weight is added to the other one.
Definition at line 152 of file MinimumCutStoerWagner.h.
|
inlineoverridevirtual |
Computes the edges defining the computed mincut and returns them.
When calling this method multiple times, the cut edges are only recomputed if the main min cut algorithm has been called in between.
Implements ogdf::MinimumCutModule< T >.
Definition at line 82 of file MinimumCutStoerWagner.h.
|
inlineprotected |
Computes minimum cut by invoking minimumCutPhase() O(|V|) times.
Definition at line 130 of file MinimumCutStoerWagner.h.
|
protected |
Computes and returns the value of the minimum cut of the current phase (iteration).
Definition at line 193 of file MinimumCutStoerWagner.h.
|
inlineoverridevirtual |
Returns a const-reference to the list of nodes belonging to one side of the bipartition.
Implements ogdf::MinimumCutModule< T >.
Definition at line 104 of file MinimumCutStoerWagner.h.
|
inlineoverridevirtual |
Returns the value of the last minimum cut computation.
Implements ogdf::MinimumCutModule< T >.
Definition at line 106 of file MinimumCutStoerWagner.h.
|
protected |
Each node has a list containing the nodes with which it has been contracted. Because the GraphCopy m_GC is destroyed during the algorithm, this is necessary to be able to determine the original nodes in the end.
Definition at line 127 of file MinimumCutStoerWagner.h.
|
protected |
Store cut edges if computed.
Definition at line 122 of file MinimumCutStoerWagner.h.
|
protected |
The modifiable version of the input graph (used for contractions)
Definition at line 113 of file MinimumCutStoerWagner.h.
|
protected |
Stores the value of the minimum cut.
Definition at line 110 of file MinimumCutStoerWagner.h.
|
protected |
Store one side of the computed bipartition.
Definition at line 119 of file MinimumCutStoerWagner.h.
|
protected |
An EdgeArray containing the corresponding edge weights.
Definition at line 116 of file MinimumCutStoerWagner.h.