igraph-help
[Top][All Lists]
Advanced

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

[igraph] Potential igraph issue: Initial assignment of zeroth vertex att


From: Magnus
Subject: [igraph] Potential igraph issue: Initial assignment of zeroth vertex attribute
Date: Sat, 24 Jan 2009 23:46:43 -0500
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)

Assigning a value to the zeroth vertex attribute for the first time seems to
result in every single vertex receiving the value in question. Assigning
attributes for other vertices, or reassigning the zeroth vertex, seems to
work as expected.

Best,
Magnus

ps. Thanks so much for igraph. Regardless of these two issues,
(which might end up getting explained), it is great software, and a
boon to network researchers in all fields.

> g <- graph.ring(10)
> V(g)[1]$a
NULL
>
> V(g)[1]$a <- "Value"
> V(g)[0]$a
[1] NA
> V(g)[1]$a
[1] "Value"
> V(g)[2]$a
[1] NA
>
> stopifnot( is.null(V(g)[2]$a) | is.na(V(g)[2]$a) )
> print("OK so far")
[1] "OK so far"
>
> g <- graph.ring(10)
> V(g)[0]$a
NULL
>
> V(g)[0]$a <- "Value"
> V(g)[0]$a
[1] "Value"
> V(g)[1]$a
[1] "Value"
> V(g)[2]$a
[1] "Value"
>
> stopifnot( is.null(V(g)[2]$a) | is.na(V(g)[2]$a) )
Error: is.null(V(g)[2]$a) | is.na(V(g)[2]$a) is not TRUE
> print("Gosh, this failed")
[1] "Gosh, this failed"
>
>
> V(g)[0]$a <- "NewValue"
> V(g)[0]$a
[1] "NewValue"
> V(g)[1]$a
[1] "Value"
> V(g)[2]$a
[1] "Value"
> print("Changing the zeroth value after first assignment works as
> expected")
[1] "Changing the zeroth value after first assignment works as expected"





reply via email to

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