GraphTheory
MinCut
find a minimal cut that separates two vertices
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
MinCut(G, s, t)
G
-
graph
s, t
vertices of the graph
flows = Matrix
The flow matrix from computing the MaxFlow from s to t, this allows MinCut to skip calling MaxFlow, and to just calculate the cut using the pre-computed flows.
output = name or list
The values to be returned from the calculation. Valid values are size, cutset, partition, or a list of any combination of those. The default is cutset.
The MinCut command finds a minimal cut of G that separates s and t, that is, a removal of edges so that t is no longer reachable from s. The cut is minimal in the sense that the sum of the weights of the edges removed is as low as possible.
In the case that t is not reachable from s in G, no work is done and the cut-set is considered to be ∅.
Otherwise, the minimal cut is computed using MaxFlow per the Max-Flow Min-Cut Theorem which says that the total weight of the minimal cut is the same as the value of the maximal flow between two vertices.
If G is not a weighted graph then every edge is treated as having a weight of 1, and thus the minimal cut is minimal in the sense of the number of edges cut.
For undirected graphs, the cut always disconnects the graph, but for directed graphs, IsConnected may still return true. However, even in directed graphs, IsReachable will always show that t can no longer be reached from s after the cut is made.
Note that the size of the minimal cut is unique, but there may be many possible choices of cut-sets that achieve the minimum size.
By default, the output is a cut-set as a set of edges. By using the output option, the size of the cut-set, or the induced partition on the vertices can be returned instead. The induced partition is two sets of vertices, the first is the set of all vertices reachable from s, and the second is the set of vertices from which t is reachable; they are always disjoint.
with⁡GraphTheory:
G6≔Graph⁡1,2,1,6,2,3,2,4,3,4,3,5,4,5,5,6
G6≔Graph 1: an undirected graph with 6 vertices and 8 edge(s)
cut1≔MinCut⁡G6,1,6
cut1≔1,6,5,6
IsCutSet⁡G6,cut1
true
HighlightEdges⁡G6,cut1
DrawGraph⁡G6
W6≔Graph⁡A,B,1,A,F,6,B,C,1,C,D,1,D,E,1,E,F,5
W6≔Graph 2: a directed weighted graph with 6 vertices and 6 arc(s)
cut2,part2≔MinCut⁡W6,A,F,output=cutset,partition
cut2,part2≔A,F,D,E,A,B,C,D,E,F
W6p≔DeleteArc⁡W6,cut2,inplace=false
W6p≔Graph 3: a directed weighted graph with 6 vertices and 4 arc(s)
IsReachable⁡W6p,A,F
false
HighlightEdges⁡W6,cut2
DrawGraph⁡W6,layout=circle
MinCut can also be used on a precomputed flow
N≔Graph⁡1,2,2,1,4,8,2,3,2,2,5,6,3,2,2,3,6,2,4,3,6,4,5,2,5,4,2,5,6,8
N≔Graph 4: a directed weighted graph with 6 vertices and 10 arc(s)
DrawGraph⁡N,layout=network
c,M≔MaxFlow⁡N,1,6
c,M≔8,020600000040020002004020000006000000
s,part,cut3≔MinCut⁡N,1,6,flows=M,output=:-size,partition,cutset
s,part,cut3≔8,1,3,4,2,5,6,1,2,3,2,3,6,4,5
c=s
8=8
DeleteArc⁡N,cut3
Graph 4: a directed weighted graph with 6 vertices and 6 arc(s)
IsReachable⁡N,1,6
StyleSubgraph⁡N,part1,vertexstylesheet=color=Goldenrod,edgestylesheet=color=Goldenrod
StyleSubgraph⁡N,part2,vertexstylesheet=color=Blue,edgestylesheet=color=Blue
Notice that after removing the cut-set, the graph is still connected as an undirected graph.
DrawGraph⁡N,layout=tree
The GraphTheory[MinCut] command was introduced in Maple 2024.
For more information on Maple 2024 changes, see Updates in Maple 2024.
See Also
IsCutSet
MaxFlow
Download Help Document