DebianでigraphとそのPython bindingsをインストールする。
Newmanが論文“Fast algorithm for detecting community structure in networks.”で提案した階層的クラスタリングのアルゴリズムが実装されているらしいので、
igraphっていうグラフライブラリを使ってみたくなった。
2008年10月現在、たぶん上記でNewmanが提案したと思われるFast greedy community detectionを図示した絵が、igraphのプロジェクトページのトップを飾ってる。
間違ってたらゴメンよ。
i386版はビルド済みパッケージがあるけど、amd64版はない。
ソースパッケージを取得してビルドする。
# fetch元 vim /etc/apt/sources.list --- deb http://cneurocvs.rmki.kfki.hu /packages/binary/ deb-src http://cneurocvs.rmki.kfki.hu /packages/source/ --- # パッケージ作りに必要なパッケージ入れる sudo aptitude install fakeroot debhelper python-all-dev python-epydoc # debパッケージ作る apt-get source libigraph python-igraph cd igraph-0.5.1 dpkg-buildpackage -rfakeroot -uc -b cd ../python-igraph-0.5.1 dpkg-buildpackage -rfakeroot -uc -b # インストール sudo dpkg -i libigraph_0.5.1_amd64.deb libigraph-dev_0.5.1_amd64.deb python-igraph_0.5.1_amd64.deb
ちなみに、RやRubyからも使えるみたい。
これらのdocumentを見つつテスト…しようと思ったけど、めんどうだなー。
というわけで、ipyhon使ってdirと?で適当に使い方を探ってみた。
試しに、Barabasiのスケールフリーネットワークってのを作ってみる。
「新ネットワーク思考」とか読んでないんだよねー。
g = igraph.Graph.Barabasi(100) # |V|=100 print g print g.maxdegree() g.write_dot('barabasi.dot')
んでgraphvizで表示してみると…おおお!それっぽい!それっぽいすよ。
というわけで、来年コレ使ってなにか発表します。