igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Question on max id node


From: Gabor Csardi
Subject: Re: [igraph] Question on max id node
Date: Tue, 11 Mar 2008 12:40:48 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

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

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,
G.

On Mon, Mar 10, 2008 at 08:00:44PM -0400, Richard Geddes wrote:
> G,
> 
> 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.
> 
> R

-- 
Csardi Gabor <address@hidden>    UNIL DGM




reply via email to

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