networkx

cd /Users/yoshinobuhiroaki/Desktop/community/taynaud-python-louvain-1f09b889de46

python setup.py install

running install

running bdist_egg

running egg_info

creating python_louvain.egg-info

writing requirements to python_louvain.egg-info/requires.txt

writing python_louvain.egg-info/PKG-INFO

writing top-level names to python_louvain.egg-info/top_level.txt

writing dependency_links to python_louvain.egg-info/dependency_links.txt

writing manifest file ‘python_louvain.egg-info/SOURCES.txt’

reading manifest file ‘python_louvain.egg-info/SOURCES.txt’

writing manifest file ‘python_louvain.egg-info/SOURCES.txt’

installing library code to build/bdist.macosx-10.6-x86_64/egg

running install_lib

running build_py

creating build

creating build/lib

creating build/lib/community

copying community/__init__.py -> build/lib/community

copying community/community_louvain.py -> build/lib/community

copying community/community_status.py -> build/lib/community

creating build/bdist.macosx-10.6-x86_64

creating build/bdist.macosx-10.6-x86_64/egg

creating build/bdist.macosx-10.6-x86_64/egg/community

copying build/lib/community/__init__.py -> build/bdist.macosx-10.6-x86_64/egg/community

copying build/lib/community/community_louvain.py -> build/bdist.macosx-10.6-x86_64/egg/community

copying build/lib/community/community_status.py -> build/bdist.macosx-10.6-x86_64/egg/community

byte-compiling build/bdist.macosx-10.6-x86_64/egg/community/__init__.py to __init__.pyc

byte-compiling build/bdist.macosx-10.6-x86_64/egg/community/community_louvain.py to community_louvain.pyc

byte-compiling build/bdist.macosx-10.6-x86_64/egg/community/community_status.py to community_status.pyc

creating build/bdist.macosx-10.6-x86_64/egg/EGG-INFO

installing scripts to build/bdist.macosx-10.6-x86_64/egg/EGG-INFO/scripts

running install_scripts

running build_scripts

creating build/scripts-2.7

copying and adjusting bin/community -> build/scripts-2.7

changing mode of build/scripts-2.7/community from 644 to 755

creating build/bdist.macosx-10.6-x86_64/egg/EGG-INFO/scripts

copying build/scripts-2.7/community -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO/scripts

changing mode of build/bdist.macosx-10.6-x86_64/egg/EGG-INFO/scripts/community to 755

copying python_louvain.egg-info/PKG-INFO -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO

copying python_louvain.egg-info/SOURCES.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO

copying python_louvain.egg-info/dependency_links.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO

copying python_louvain.egg-info/requires.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO

copying python_louvain.egg-info/top_level.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO

zip_safe flag not set; analyzing archive contents…

creating dist

creating ‘dist/python_louvain-0.4-py2.7.egg’ and adding ‘build/bdist.macosx-10.6-x86_64/egg’ to it

removing ‘build/bdist.macosx-10.6-x86_64/egg’ (and everything under it)

Processing python_louvain-0.4-py2.7.egg

Copying python_louvain-0.4-py2.7.egg to /Users/yoshinobuhiroaki/anaconda/lib/python2.7/site-packages

Adding python-louvain 0.4 to easy-install.pth file

Installing community script to /Users/yoshinobuhiroaki/anaconda/bin

Installed /Users/yoshinobuhiroaki/anaconda/lib/python2.7/site-packages/python_louvain-0.4-py2.7.egg

Processing dependencies for python-louvain==0.4

Searching for networkx==1.11

Best match: networkx 1.11

Adding networkx 1.11 to easy-install.pth file

Using /Users/yoshinobuhiroaki/anaconda/lib/python2.7/site-packages

Searching for decorator==4.0.10

Best match: decorator 4.0.10

Adding decorator 4.0.10 to easy-install.pth file

Using /Users/yoshinobuhiroaki/anaconda/lib/python2.7/site-packages

Finished processing dependencies for python-louvain==0.4

export PATH=$PATH:’/Users/yoshinobuhiroaki/Desktop/community/taynaud-python-louvain-1f09b889de46/build/lib/community’

import community
import networkx as nx
import matplotlib.pyplot as plt
G = nx.karate_club_graph()
partition = community.best_partition(G)
size = float(len(set(partition.values())))
pos = nx.spring_layout(G)
count = 0.
for com in set(partition.values()):
    count += 1.
    list_nodes = [nodes for nodes in partition.keys() if partition[nodes] == com]
    nx.draw_networkx_nodes(G, pos, list_nodes, node_size=20, node_color = str(count/size) )
plt.show()


Screenshot 2016-11-20 18.56.51.png

参考

http://qiita.com/ysekky/items/985cf01d21c742be92e3

Advertisements