igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Extracting vertex coordinates after plot command, and using


From: Tamás Nepusz
Subject: Re: [igraph] Extracting vertex coordinates after plot command, and using weights in fruchterman_reingold
Date: Tue, 15 Mar 2011 15:52:24 +0100

> I have labels for each vertex through graph.vs["label"] = array of names, is 
> this information accessible through querying the layout, so I can have the 
> coord & name eg row[0], row[1], label ?
The layout itself is just a list of coordinates, so the labels are not 
available, but you can make use of the fact that the coordinates in the layout 
are in the same order as the vertices in the graph, so you can do this:

from itertools import izip
for name, (x, y) in izip(graph.vs["label"], layout):
    print "%s\t%f\t%f" % (name, x, y)

-- 
T.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]