igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Potential igraph issue: Initial assignment of zeroth verte


From: Gábor Csárdi
Subject: Re: [igraph] Potential igraph issue: Initial assignment of zeroth vertex attribute
Date: Sun, 25 Jan 2009 10:57:19 +0100

Yep, this is another bug. Vertex/edge attribute values are recycled in
the assignment, but the recycling code was buggy if the assignment
involved only a subset of vertices. I have corrected this and will
commit it to the igraph development branch ASAP, after some testing.

Thanks for reporting it!

Gabor

On Sun, Jan 25, 2009 at 5:46 AM, Magnus <address@hidden> wrote:
> 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"
>
>
>
> _______________________________________________
> 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]