diff --git a/destroy_p3.py b/destroy_p3.py index ec38966..f7e45e3 100644 --- a/destroy_p3.py +++ b/destroy_p3.py @@ -32,7 +32,8 @@ del_list = [] G = read_graph(args.graph) n = len(G.nodes) while max_comp_size(G) > n / 2: - mnc = nx.minimum_node_cut(G=G) + H = max((G.subgraph(c) for c in nx.connected_components(G)), key=len) + mnc = nx.minimum_node_cut(G=H) del_list.append(mnc) G.remove_nodes_from(mnc)