From ca44105faebd606411fc02aad556ddd4ba12c6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Thu, 24 Sep 2020 14:07:58 +0200 Subject: [PATCH] use connected components --- destroy_p3.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)