igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] extracting lists


From: Thiago M. Venancio
Subject: Re: [igraph] extracting lists
Date: Mon, 26 Jan 2009 18:46:33 -0500

Hi,

The file graph.txt is a ncol format graph.
I got a clue here. What happens is that the V(graph) command returns an integer type data that starts in the position zero. So, the degree in deg[1] is relative to vec[0] vertex.
I would like to transform the vec (integer type) to get a vector with node names (not numerical IDs). Every time I use as.vector and relative commands I get the numerical IDs and not the names.

Hope you can help me now with the additional info provided.

Thanks.

Thiago

On Mon, Jan 26, 2009 at 5:56 PM, Gábor Csárdi <address@hidden> wrote:
On Mon, Jan 26, 2009 at 10:23 PM, Thiago M. Venancio
<address@hidden> wrote:
> Hi all,
>
> After loading the graph in R, I would like to extract the list with vertices
> names and their degrees.
> I know how to save both variables in vectors, however they seem to be in
> different orders. For example, the degree of the first element in the vector
> with vertices names is not allocated in the first position in the degree
> vector.
> Here is what I am doing:
>
> graph = read.graph("graph.txt", format="ncol")
> deg = degree(graph)
> vec = V(graph)

Hi,

it is hard to guess what is in 'graph.txt', but 'deg' and 'vec' are
"in order" here, i.e. deg[1] belongs to vec[1], etc.

You need to give us a reproducible example to see what goes wrong for you.

Gabor

> Any help is appreciated.
>
> Best,
>
> Thiago
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
>



--
Gabor Csardi <address@hidden>     UNIL DGM


_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help




reply via email to

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