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 . More... | |
virtual T | call (const Graph &G, const EdgeArray< T > &weights) override |
Computes a minimum cut on graph G with non-negative weights on edges. More... | |
virtual const ArrayBuffer< edge > & | edges () override |
Computes the edges defining the computed mincut and returns them. More... | |
virtual const ArrayBuffer< node > & | nodes () override |
Returns a const-reference to the list of nodes belonging to one side of the bipartition. More... | |
virtual T | value () const override |
Public Member Functions inherited from ogdf::MinimumCutModule< double > | |
virtual | ~MinimumCutModule () |
Do nothing on destruction. More... | |
virtual double | call (const Graph &G, const EdgeArray< double > &weights)=0 |
Computes the minimum cut of G with edge weights weights . More... | |
virtual double | value () const=0 |
Returns the value of the last minimum cut computation. More... | |
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. More... | |
void | mainLoop () |
Computes minimum cut by invoking minimumCutPhase() O(|V|) times. More... | |
T | minimumCutPhase () |
Computes and returns the value of the minimum cut of the current phase (iteration). More... | |
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. More... | |
ArrayBuffer< edge > | m_cutEdges |
Store cut edges if computed. More... | |
GraphCopy | m_GC |
The modifiable version of the input graph (used for contractions) More... | |
T | m_minCut |
Stores the value of the minimum cut. More... | |
ArrayBuffer< node > | m_partition |
Store one side of the computed bipartition. More... | |
EdgeArray< T > | m_w |
An EdgeArray containing the corresponding edge weights. More... | |
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 59 of file MinimumCutStoerWagner.h.
|
inlineoverridevirtual |
Computes a minimum cut on graph G
.
Implements ogdf::MinimumCutModule< double >.
Definition at line 61 of file MinimumCutStoerWagner.h.
|
inlineoverridevirtual |
Computes a minimum cut on graph G
with non-negative weights
on edges.
Definition at line 67 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 161 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< double >.
Definition at line 91 of file MinimumCutStoerWagner.h.
|
inlineprotected |
Computes minimum cut by invoking minimumCutPhase() O(|V|) times.
Definition at line 139 of file MinimumCutStoerWagner.h.
|
protected |
Computes and returns the value of the minimum cut of the current phase (iteration).
Definition at line 202 of file MinimumCutStoerWagner.h.
|
inlineoverridevirtual |
Returns a const-reference to the list of nodes belonging to one side of the bipartition.
Implements ogdf::MinimumCutModule< double >.
Definition at line 113 of file MinimumCutStoerWagner.h.
|
inlineoverridevirtual |
Definition at line 115 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 136 of file MinimumCutStoerWagner.h.
|
protected |
Store cut edges if computed.
Definition at line 131 of file MinimumCutStoerWagner.h.
|
protected |
The modifiable version of the input graph (used for contractions)
Definition at line 122 of file MinimumCutStoerWagner.h.
|
protected |
Stores the value of the minimum cut.
Definition at line 119 of file MinimumCutStoerWagner.h.
|
protected |
Store one side of the computed bipartition.
Definition at line 128 of file MinimumCutStoerWagner.h.
|
protected |
An EdgeArray containing the corresponding edge weights.
Definition at line 125 of file MinimumCutStoerWagner.h.