Imagine I have the graph below.
Minimum cut of this graph is 2 which means it takes at least removing 2 edges to make this graph disconnected. I want to get all the possible set of edges that satisfy this number and removing them makes graph disconnected. in this example [(4,8),(3,5)] and [(5,6),(6,7)]
with the help of internet I find the code below:
import networkx as nx
# creating test graph
test_graph = nx.Graph()
test_graph.add_edge(0, 1)
test_graph.add_edge(0, 2)
test_graph.add_edge(0, 4)
test_graph.add_edge(1, 2)
test_graph.add_edge(1, 3)
test_graph.add_edge(2, 3)
test_graph.add_edge(2, 4)
test_graph.add_edge(3, 4)
test_graph.add_edge(3, 5)
test_graph.add_edge(4, 8)
test_graph.add_edge(5, 6)
test_graph.add_edge(5, 7)
test_graph.add_edge(5, 8)
test_graph.add_edge(6, 7)
test_graph.add_edge(7, 9)
test_graph.add_edge(8, 9)
test_graph.add_edge(8, 10)
test_graph.add_edge(8, 11)
test_graph.add_edge(9, 10)
test_graph.add_edge(9, 11)
test_graph.add_edge(10, 11)
print(nx.minimum_edge_cut(test_graph))
but it only returns the first edges it finds (in this case [(5,6),(6,7)] but I want all the candidates. can any body help me pls?
This calculates all the possible cuts, identifies the shortest ones, cleans the different permutations. The result is: [{(3, 5), (4, 8)}, {(5, 6), (6, 7)}].
Please be aware that this is surely not the most efficient nor the most elegant solution.