Created
April 5, 2020 14:07
-
-
Save prateekjoshi565/fc26925cf60be008c51bc6d47d9c410e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def girvan_newman(graph): | |
# find number of connected components | |
sg = nx.connected_components(graph) | |
sg_count = nx.number_connected_components(graph) | |
while(sg_count == 1): | |
graph.remove_edge(edge_to_remove(graph)[0], edge_to_remove(graph)[1]) | |
sg = nx.connected_components(graph) | |
sg_count = nx.number_connected_components(graph) | |
return sg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment