Sait
Sait

Reputation: 19815

igraph plot graph: Killed 9

I am new to igraph, trying to plot a graph contains ~450k vertices.

I started with doing some experiments:

import igraph
g = igraph.Graph([(0,1), (0,2), (2,3), (3,4), (4,2), (2,5), (5,0), (6,3), (5,6)])
igraph.plot( g, "result.pdf", layout = g.layout("kk") )
# works perfect.

Then, I loaded my ~450k-vertice graph and had an error plotting the graph. I thought it was because the graph was too big. So, I tried plotting with a smaller graph like the following:

g = igraph.Graph( [(1, 63741), (2, 81483), (3, 91394), (4, 60469), (5, 60278), (6, 64544), (6, 73526), (8, 86588), (9, 61415)] )
igraph.plot( g, "result.pdf", layout = g.layout("kk") )
# does not work. produces:
# "Killed: 9" 

However, I had the same problem with this graph.

Since I am able to draw a small graph and not able to draw a big one, I am not sure if it is a syntax problem or igraph does not handle big graphs?

I am using Mac OS X. Python 2.7.6. igraph 0.7.1.

Upvotes: 1

Views: 674

Answers (1)

Tamás
Tamás

Reputation: 48071

Your "smaller" graph actually contains 91395 vertices. Vertex IDs in igraph are integers from zero to |V|-1, so as soon as you create an edge with endpoint 91394, you are also creating 91395 vertices (if they didn't exist before). Also, I'm pretty sure that plotting such a large graph would not work out of the box, or even if it worked, you would only get a huge hairball in the end since most layout algorithms are not designed to deal with graphs of this size. Among the ones included in igraph, only the DrL algorithm scales up properly to really large graphs (or maybe the grid-based Fruchterman-Reingold layout), but even then you would need to do lots of tweaking with the vertex and font sizes to get something that is even remotely useful.

Upvotes: 2

Related Questions