[Top][All Lists]

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

Re: [igraph] about vertex id (in R)

From: Qunawei Zhang
Subject: Re: [igraph] about vertex id (in R)
Date: Tue, 17 Dec 2013 19:57:44 -0500
User-agent: Microsoft-MacOutlook/

Hi Tamas:

Yes. It confused me for a while, but I am clear about it now.


On 12/17/13 6:20 PM, "Tamás Nepusz" <address@hidden> wrote:

>> gene pair. So I firstly mapped the genes into ids (from 1 to n, where n
>>is the gene number) and then describe the network by ids. Finally I used
>>"read.graph(file="biggestComponent_id.txt",format="edge list") to input
>>the network. But I found the ids seems different from the input ids
>>(likely added by "1").
>Most of igraph is written in C, which uses zero-based indices by default
>(so edge and vertex IDs start from zero). However, R is using 1-based
>indices everywhere so the R interface of igraph also provides 1-based
>indexing almost everywhere; the only exception is the edgelist file
>format. This is because edge list files may be saved and loaded from the
>C core of igraph or from the Python interface of igraph as well, so there
>would be quite a bit of confusion if edge lists saved from R used 1-based
>indices while edge lists saved from C or Python used 0-based indices.
>Therefore, whenever you load an edge list into igraph¹s R interface,
>igraph assumes that the vertex indices in the file are 0-based and adds 1
>to them automatically to obtain the vertex IDs that R will use.
>Similarly, whenever you save an edge list from igraph¹s R interface into
>a file, igraph will subtract 1 from the vertex IDs used in R to obtain a
>0-based indexing.
>igraph-help mailing list

reply via email to

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