[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Node names
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] Node names |
Date: |
Thu, 24 Oct 2013 11:06:33 +0200 |
Hi,
> I have a graph:
> [...]
> and I'd like to output a list of all the node numbers beside their name,
> something like:
> [...]
> How do I do this please?
It is not clear from your question whether you are using igraph from Python or
R, so I'l answer both. In R, the easiest way is probably as follows:
> data.frame(name=V(g)$name)
which simply exploits the fact that printing a data.frame yields the output
format that you want.
In Python, you can do this:
for vertex in g.vs:
print vertex.index, vertex["name"]
--
Tamas