igraph-help
[Top][All Lists]
Advanced

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

RE: [igraph] extract network stats for a subset of nodes


From: bfjghod jdlkajjf
Subject: RE: [igraph] extract network stats for a subset of nodes
Date: Wed, 14 Oct 2009 14:29:13 +0000

Hi Gabor,

Thanks for raising that point. Actually, for some reason, I noticed that as well and rectified it. 

But I like the simpler syntax. 

Thank you as well as Tamas for your help.

Will

> Date: Wed, 14 Oct 2009 13:58:52 +0200
> Subject: Re: [igraph] extract network stats for a subset of nodes
> From: address@hidden
> To: address@hidden
>
> On Mon, Oct 12, 2009 at 12:07 PM, Tamas Nepusz <address@hidden> wrote:
> > Dear Will,
> >
> > I'm not an R expert, so there might be an easier way to do that, but
> > this seems to work:
> >
> >> g <- grg.game(100, 0.2)
> >> V(g)$name <- LETTERS
> >> degree(g, which(V(g)$name %in% c("A", "F", "X")))
>
> There is a small mistake here, the infamous 0-1 catch. Vertices are
> numbered from zero, and which() returns indices starting from one. So
> you need to subtract one.
>
> It is a bit simpler to use match():
> degree(g, match( c("A","F","X"), V(g)$name )-1)
>
> G.
>
> >
> > --
> > Tamas
> >
> >
> > _______________________________________________
> > 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


Windows Live: Keep your friends up to date with what you do online.

reply via email to

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