jayelm
jayelm

Reputation: 7678

Where can I find the igraph layout source code?

I've been looking all over (igraph-python docs, the c reference manual) and I can't seem to find a trace of the code in the python-igraph module for the various layout algorithms used.

In iPython I can do Graph.layout_kamada_kawai? and Graph.layout_kamada_kawai??. The former gives me a C-like docstring, while the latter gives me a couple lines of code in __init__.py that is most definitely not the layout algorithm.

If the code for these algorithms (specifically kamada_kawai) is in the C core distribution, if you could point me to the source code directories, that'd be great as well. I'm on Linux.

Upvotes: 1

Views: 465

Answers (2)

Gabor Csardi
Gabor Csardi

Reputation: 10825

python-igraph is just a wrapper to the igraph C library, and all the sources are on github. The layout algorithms you are looking for are here: https://github.com/igraph/igraph/blob/master/src/layout.c

Actually, some of them, e.g. the Kamada-Kawai was just rewritten in the development version of igraph. This new version now follows the original paper completely, and it is about 100 times faster (for graphs with ~500 vertices) than the old version. It is here: https://github.com/igraph/igraph/blob/develop/src/layout_kk.c

Upvotes: 2

Ron
Ron

Reputation: 1269

I think I may have found what your looking for by downloading the source code for igraph here http://pypi.python.org/packages/source/p/python-igraph/python-igraph-0.6.5.tar.gz decompressing it into a temp directory and then going to the python-igraph-0.6.5/src subdirectory in a terminal.

Doing grep -rn layout_kamada_kawai ./ tells me theres a function called igraphmodule_Graph_layout_kamada_kawai on line 6029 and 12925 in the graphobject.c file.

Is this what you where looking for?

Upvotes: 2

Related Questions