all_minimum_st_cuts#
- graph_tool.flow.all_minimum_st_cuts(g, source, target, capacity=None, max_n=0, partitions=False)[git][source]#
Return all minimum cuts between two vertices.
- Parameters:
- g
Graph Graph to be used.
- source
Vertexorint Source vertex.
- target
Vertexorint Target vertex.
- capacity
EdgePropertyMap(optional, default:None) Edge capacities. If not given, every edge has unit capacity.
- max_n
int(optional, default:0) If positive, at most this number of cuts is returned.
- partitions
bool(optional, default:False) If
True, the source sides of the cuts are also returned.
- g
- Returns:
- cuts
listofnumpy.ndarray The edge indices of every minimum cut.
- parts
listofnumpy.ndarray The vertices on the source side of every cut. Only returned if
partitions == True.
- cuts
See also
minimum_st_cutA single minimum s-t cut
all_minimum_vertex_separatorsAll minimum vertex separators
edge_connectivityEdge connectivity
Notes
A minimum \(s\)-\(t\) cut is a set of edges of minimum total capacity whose removal leaves no path from \(s\) to \(t\) (for directed graphs, the edges from the source side to the target side). After a maximum flow is computed, the source sides of all minimum cuts are the vertex sets that contain \(s\) but not \(t\) and are closed in the residual network [picard-structure-1980]. They are enumerated with the branching scheme of Provan and Shier [provan-paradigm-1996], in which every branch ends in a cut, so that the time is \(O(V(V+E))\) per cut, after a maximum flow computed with the Boykov-Kolmogorov algorithm. The vertices that cannot be reached from \(s\) are always placed on the target side, since they do not change the cut edges. If \(t\) cannot be reached from \(s\), a single empty cut is returned. The number of minimum cuts can grow exponentially with the size of the graph.
References
[picard-structure-1980]Jean-Claude Picard and Maurice Queyranne, “On the structure of all minimum cuts in a network and applications”, Mathematical Programming Study 13, 8-16 (1980), DOI: 10.1007/BFb0120902 [sci-hub, @tor]
[provan-paradigm-1996]J. Scott Provan and Douglas R. Shier, “A paradigm for listing (s,t)-cuts in graphs”, Algorithmica 15, 351-372 (1996), DOI: 10.1007/BF01961544 [sci-hub, @tor]
Examples
>>> g = gt.Graph([(0, 1), (0, 2), (1, 3), (2, 3), (3, 4)], directed=False) >>> cuts = gt.all_minimum_st_cuts(g, 0, 4) >>> print(cuts) [array([4], dtype=uint64)]