[Top][All Lists]

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

Re: [igraph] Question on max id node

From: Richard Geddes
Subject: Re: [igraph] Question on max id node
Date: Tue, 11 Mar 2008 13:38:32 -0400
User-agent: Thunderbird (X11/20080227)


Thanks for the description of vertex id's vs vertex attributes... it did clear things up for me.

I think I was misusing the the term 'id' from the igraph point of view.   I really should have used the the term 'name attribute'. 

The name attribute makes for a good reference back to the graph originally imported, and when using non-igraph routines and looking for intermediate verification, a fixed reference such as the vertex name attribute can make life easier.


Gabor Csardi wrote:
Ok, so we know the reason at least. I'll see what i can do to correct 

Some more clarification about vertex ids/attributes. In every igraph graph,
vertices have numeric ids starting with zero, up to number_of_nodes-1.
This is always true, e.g. if you delete some vertices then the ids are 
renumbered. Think of the vertices as balls in a tube, one after the another,
the ids are the _positions_ of the balls. 

Vertex attributes are arbitrary labels atteched to vertices. Vertex attributes
are preserved. E.g. if a graph has vertex attribute named "foo" and 
vertex 3 (internal, position 3) has "foo" value "foobar", and you remove 
vertex 2 from this graph, then vertex 3 becomes vertex 2 (although you 
should not rely on the ordering being kept),
but it's "foo" attribute will be still "foobar".

..._edgelist interprets the numbers in the file as internal vertex ids.
The number of vertices in the graph will be set to the highest id+1.
E.g. if you have only 
99 100
in your file, then the number of vertices will be 101, and 99 vertices
will be isolate.

..._ncol interprets the _strings_ in the file as vertex labels, 
and one vertex is created for each label. I.e. for the same one line 
file, a graph with two vertices is created (internal ids 0 and 1) and
their "name" attributes will be set to "99" and "100", respectively.

Now that i think back, why do you need the attributes? The subject 
of this email is (still) "...max id node". So if you need the max.
internal id, that is always vcount()-1. 

Hope it is clear now,

On Mon, Mar 10, 2008 at 08:00:44PM -0400, Richard Geddes wrote:

I think the problem is in the file format end-of-line character of the file,
which originally was made on a windows machine.� I converted the dos format to
linux with

tr -d '\r' < dos.pairs > linux.pairs

and results are consistent now.� I've attached the file in question (dos.pairs)
and the linux version so you can verify.

I had this problem not too long ago with some scripting code I was writing and
should have suspected the same was happening here.

... I ran the update routine:

$0> cd (path to)igraph-dev-0.6
$0> tla update
$0> ./bootstrap.sh
$0> ./configure
$0> make
$0> sudo make install

The 'make check' returned a value of 0 (good)

Yes, I follow about the internal renaming of the nodes...
Is the attribute method the best method to get at the internal igraph node id
values... I didn't really get to that part yet.



reply via email to

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