'Is there a method to find girvan newman using CuGraph?
I have been using the Girvan-Newman algorithm from networkx to find the modularity of a network with 4039 nodes and 88,234 edges. Due to the nature of the algorithm, it was running overnight, and wouldn't complete. Hence I paid for colab pro and I was intending to use CuGraph to speed this up, but can't find a CuGraph algorithm that does work. How would I be able to build one, using the edge centrality algorithm, to produce something similar to this:
G2 = nx.karate_club_graph()
comp = girvan_newman(G2)
node_groups = []
for com in next(comp):
node_groups.append(list(com))
print(node_groups)
color_map = []
for node in G2:
if node in node_groups[0]:
color_map.append('blue')
else:
color_map.append('green')
nx.draw(G2, node_color=color_map, with_labels=True)
plt.show()
Solution 1:[1]
The Girvan-Newman algorithm is not in cuGraph. It is a very sequential algorithm where you run betweenness centrality and then drop edge with the highest score. Then just keep repeating that process.
If you are interested in Modularity, you could use either the Louvain, Leiden, ECG, or Spectral community detection algorithms.
A graph with 88 thousand edges should be a few seconds
Solution 2:[2]
Girvan Newman Algorithm just partitions the network on the basis of highest edge betweenness, calculates the modularity for each community structure, and returns the structure having maximum Q. GN is not to optimize modularity. Use Louvain and its improved version Leiden or Fast Greedy: (Clauset-Newman-Moore community detection).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Brad Rees |
| Solution 2 | ROHI TARIQ |
