[Top][All Lists]

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

Re: [igraph] Dose the index of vertices in a graph start from 0?

From: Gábor Csárdi
Subject: Re: [igraph] Dose the index of vertices in a graph start from 0?
Date: Thu, 15 Sep 2011 07:35:54 -0400

On Thu, Sep 15, 2011 at 4:27 AM, Minh Nguyen <address@hidden> wrote:
> Hi,
> On Thu, Sep 15, 2011 at 6:23 PM, Zhijiang Wang
> <address@hidden> wrote:
>> Thanks!
>> why is the 0-starting index is used?
> In computer science, our indices start from zero. In mathematics,
> indices start from one. Graph theory as treated by igraph is
> considered computer science. And people who develop igraph are
> computer scientists.

Another reason for the 0-based indexing was that igraph internals are
written in C, and C uses 0-based indices for arrays, so it was natural
(for a computer scientist at least) to go with that. Keeping the
zero-based indexing in R simplified a lot of things, and made igraph
somewhat faster.

Soon I realized that 0-based in indices are causing problems in R.
This will be only corrected in the coming 0.6 version, where vertices
are indexed from 1 (if you use igraph from R). This also means that
existing code will no longer be compatible with the new 0.6 version,


>> 于 2011-9-15 16:19, Minh Nguyen 写道:
>> Hi,
>> 2011/9/15 Zhijiang Wang <address@hidden>:
>> Dear all,
>> I used the function maximal.cliques, and found the smallest index of
>> vertices is 0.
>> So, dose the index of vertices in a graph start from 0?
>> Yes.
> --
> Regards
> Minh Van Nguyen
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help

Gabor Csardi <address@hidden>     MTA KFKI RMKI

reply via email to

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