The problem occurs when replacing all the edges with a vector of new edges
and one or more values in the new vector is a zero.  It doesn't occur if a
subset of edges is selected.

BTW, the reason I can't easily use E(g)$attr <- newvals on all occassions
is because I need to match newvals from a larger separate matrix where the
rows and cols have vertex ids but are in a different order from the
vertices in graph.

see below - same behaviour on Win or Unix platform:

> g <- graph.ring(10)
> g1 <- g
> g1[from = el[,1], to = el[,2], attr = "rtdev"] <- rep(0,10)
> g1
IGRAPH U--- 10 0 -- Ring graph
+ attr: name (g/c), mutual (g/x), circular (g/x)
> g1 <- g
> g1[from = el[,1], to = el[,2], attr = "rtdev"] <- c(1,2,3,4,5,6,7,8,9,10)
> g1
IGRAPH U--- 10 10 -- Ring graph
+ attr: name (g/c), mutual (g/x), circular (g/x), rtdev (e/n)
> g1[from = el[,1], to = el[,2], attr = "rtdev"] <- c(0,2,3,4,5,6,7,8,9,10)
> g1
IGRAPH U--- 10 0 -- Ring graph
+ attr: name (g/c), mutual (g/x), circular (g/x), rtdev (e/n)
> g1 <- g
> g1[from = el[,1], to = el[,2], attr = "rtdev"] <- 1
> g1
IGRAPH U--- 10 10 -- Ring graph
+ attr: name (g/c), mutual (g/x), circular (g/x), rtdev (e/n)
> g1[from = el[2,1], to = el[2,2], attr = "rtdev"] <- 0
> g1
IGRAPH U--- 10 9 -- Ring graph
+ attr: name (g/c), mutual (g/x), circular (g/x), rtdev (e/n)
>

cheers
Tony





On 31 October 2012 17:53, Gábor Csárdi <[email protected]> wrote:

> On Wed, Oct 31, 2012 at 12:47 PM, Gábor Csárdi <[email protected]>
> wrote:
> > On Wed, Oct 31, 2012 at 12:32 PM, Tony Larson <[email protected]>
> wrote:
> >> Thanks Gabor,
> >> That's helpful.
> >>
> >> However, another problem I've run across is setting edge attributes.
>  If I
> >> add a new numeric edge attribute with a value of  0 for ANY edge (or
> all,
> >> edges but a single 0 is enough), ALL edges are deleted!
> >
> > Probably this is a bug, I'll investigate it.
>
> I actually cannot reproduce this. The following all works fine:
>
> library(igraph)
>
> g <- graph.ring(10)
> g[1,2,attr="weight"] <- 0
> g
>
> el <- get.edgelist(g)
> g[from=el[,1], to=el[,2], attr="sim"] <- seq_len(ecount(g))
> g
>
> V(g)$name <- letters[seq_len(vcount(g))]
> el <- get.edgelist(g)
> g[from=el[,1], to=el[,2], attr="sim"] <- seq_len(ecount(g))
> g
>
> So I'll need some information on what exactly you did, including toy
> data that shows the problem.
>
> Best,
> Gabor
>
> [...]
>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to