[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Sorting a graph or assigning attributes based on vertex nam
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] Sorting a graph or assigning attributes based on vertex names |
Date: |
Wed, 31 Oct 2012 12:31:01 -0400 |
On Tue, Oct 30, 2012 at 6:18 PM, Tamás Nepusz <address@hidden> wrote:
> Hi,
>
> First I would try replacing set.vertex.attribute(g, "bucket", vid, bv[i])
> with:
>
> V(g)$bucket[vid] <- bv[i]
>
> I think this avoids copying the graph. Also, I would even try this (not sure
> if it works, but it's worth a try):
Just to avoid mistakes in the archives. This also copies the graph. It
is stupid, but it does. It is very hard to modify objects in place in
R.
> V(g)$bucket[sortedVertexIDs] <- bv
This might work, but only if your vertex names are numbers from one to
number-of-vertices, I believe.
Gabor
[...]