我已经在python lib NetorwkX中创建了一个图,我想实现一个模块化算法,以便对我的图的节点进行聚类。我遇到了以下代码:
import community
import matplotlib.pyplot as plt
import networkx as nx
G = nx.Graph()
G = nx.read_weighted_edgelist('graphs/fashionGraph_1.edgelist')
nx.transitivity(G)
# Find modularity
part = community.best_partition(G)