igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] What's wrong with vcount() ?


From: Tamás Nepusz
Subject: Re: [igraph] What's wrong with vcount() ?
Date: Fri, 15 Mar 2013 20:12:17 +0100

> I face strange problem with vcount(). I tried to get the number of
> nodes form an edge list graph (see attachment).
> Using vcount() it returns 502 but in fact it is 262 nodes ???
No, it has 502 nodes since there is an edge from vertex 35 to vertex 501 
according to the file, and the nodes are indexed from zero upwards in an 
edgelist file. So, if the highest node ID is 501 in your file, it means that it 
has 502 nodes. Of course it may happen that lots of your nodes have no attached 
edges.

If your numeric IDs are not continuous, you may want to read the file using the 
NCOL format instead of edgelist. In this case, igraph will treat the numbers in 
the file as symbolic names and it will attach them to the "name" vertex 
attribute. However, in this case, the nodes will be ordered arbitrarily and you 
will have to look up the appropriate indices based on the "name" vertex 
attribute.

-- 
T.


reply via email to

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