我正在研究網絡中的檢測社區。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