import numpy as np import networkx as nx import matplotlib.pyplot as plt import community import collections from collections import Counter from sklearn import preprocessing, metrics G = nx.karate_club_graph() G_cls = G.copy() # クラスタリング結果用 print(nx.info(G)) # GraphRicciCurvatureからお借りしたhelper関数 # clustering_labelに対し、自動で色付けしてくださる。 def draw_graph(G, clustering_label="club"): """ A helper function to