Interface MinimumCutST
-
public interface MinimumCutSTMinimum Cut algorithm with terminal vertices (source-sink, S-T).Given a graph \(G=(V,E)\), a cut is a partition of \(V\) into two sets \(C, \bar{C} = V \setminus C\). Given a weight function, the weight of a cut \((C,\bar{C})\) is the weight sum of all edges \((u,v)\) such that \(u\) is in \(C\) and \(v\) is in \(\bar{C}\). There are two variants of the problem to find a minimum weight cut: (1) With terminal vertices, and (2) without terminal vertices. In the variant with terminal vertices, we are given two special vertices
source (S)andsink (T)and we need to find the minimum cut \((C,\bar{C})\) such that thesourceis in \(C\) and thesinkis in \(\bar{C}\). In the variant without terminal vertices we need to find the global cut, and \(C,\bar{C}\) simply must not be empty.Algorithms implementing this interface compute the minimum cut given two terminal vertices,
source (S)andsink (T).- Author:
- Barak Ugav
- See Also:
- Wikipedia
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceMinimumCutST.BuilderA builder forMinimumCutSTobjects.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description CutcomputeMinimumCut(Graph g, WeightFunction w, int source, int sink)Compute the minimum cut in a graph and a weight function with two terminal vertices.static MinimumCutST.BuildernewBuilder()Create a new minimum cut algorithm builder.static MinimumCutSTnewFromMaximumFlow(MaximumFlow maxFlowAlg)Create a new minimum cut algorithm using a maximum flow algorithm.
-
-
-
Method Detail
-
computeMinimumCut
Cut computeMinimumCut(Graph g, WeightFunction w, int source, int sink)
Compute the minimum cut in a graph and a weight function with two terminal vertices.Given a graph \(G=(V,E)\), a cut is a partition of \(V\) into twos sets \(C, \bar{C} = V \setminus C\). The return value of this function is the set \(C\), and \(\bar{C}\) can be computed easily by the caller if needed.
- Parameters:
g- a graphw- an edge weight functionsource- a special vertex that will be in \(C\)sink- a special vertex that will be in \(\bar{C}\)- Returns:
- the cut that was computed
- Throws:
IllegalArgumentException- if the source and the sink are the same vertex
-
newBuilder
static MinimumCutST.Builder newBuilder()
Create a new minimum cut algorithm builder.This is the recommended way to instantiate a new
MinimumCutSTobject.- Returns:
- a new builder that can build
MinimumCutSTobjects
-
newFromMaximumFlow
static MinimumCutST newFromMaximumFlow(MaximumFlow maxFlowAlg)
Create a new minimum cut algorithm using a maximum flow algorithm.By first computing a maximum flow between the source and the sink, the minimum cut can be realized from the maximum flow without increasing the asymptotical running time of the maximum flow algorithm running time.
- Parameters:
maxFlowAlg- a maximum flow algorithm- Returns:
- a minimum cut algorithm based on the provided maximum flow algorithm
-
-