use connected components
continuous-integration/drone/push Build encountered an error Details

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
1 changed files with 2 additions and 1 deletions

View File

@ -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)