use connected components
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Torma Kristóf 2020-09-24 14:07:58 +02:00
parent 0c4842a6f5
commit ca44105fae
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -32,7 +32,8 @@ del_list = []
G = read_graph(args.graph) G = read_graph(args.graph)
n = len(G.nodes) n = len(G.nodes)
while max_comp_size(G) > n / 2: 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) del_list.append(mnc)
G.remove_nodes_from(mnc) G.remove_nodes_from(mnc)