igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] assign value to node using neighbor attributes


From: Gábor Csárdi
Subject: Re: [igraph] assign value to node using neighbor attributes
Date: Sat, 26 Jun 2010 19:48:43 +0200

Mathias,

you cannot do this with simple assignment, you need a loop, or
something similar.  E.g.

V(g)$an <- sapply(V(g), function(x) mean(V(g)[neighbors(g, x)]$a, na.rm=TRUE))

should work.

Best,
Gabor

On Thu, Jun 24, 2010 at 7:35 PM, mathias kuhnt
<address@hidden> wrote:
> Hi!
>
> is it possible to assign in a simple way attributes to a node that depend on
> the attributes of all neighbors?
>
> may be this explains what I want even if it does not work this way:
>
> V(g)$an<-mean(V(g)[nei(???)]$a,na.rm=T)
>
>
> Thanks for your help,
> Mathias
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM



reply via email to

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