我正在研究网络中的检测社区。Networkx中的社区检测
我使用的igraph和Python
对于社区的最佳数量的模块化测量方面:
from igraph import *
karate = Nexus.get("karate")
cl = karate.community_fastgreedy()
cl.as_clustering().membership
供应所需的一些社区:
from igraph import *
karate = Nexus.get("karate")
cl = karate.community_fastgreedy()
k=2
cl.as_clustering(k).membership
不过,我喜欢使用networkx来做到这一点。我知道获得模块化度量方面,社区的最佳数量:
import community # --> http://perso.crans.org/aynaud/communities/
import fastcommunity as fg # --> https://networkx.lanl.gov/trac/ticket/245
import networkx as nx
g = nx.karate_club_graph()
partition = community.best_partition(g)
print "Louvain Modularity: ", community.modularity(partition, g)
print "Louvain Partition: ", partition
cl = fg.communityStructureNewman(g)
print "Fastgreed Modularity: ", cl[0]
print "Fastgreed Partition: ", cl[1]
但我不能得到社区的所需数量。有没有一些使用Networkx的算法?
这是一个非常新的工作,但非常有用:HTTPS ://journals.aps.org/prl/abstract/10.1103/PhysRevLett.117.078301 – Peaceful