|
From: | Dan Auerbach |
Subject: | [igraph] Non-atomic attributes? |
Date: | Sat, 31 Jan 2009 15:24:48 -0700 |
Apologies if I've missed something obvious, but a search through the list archives and the help and documentation on the igraph homepage hasn't helped so far... Using 2.8.1 and 0.5.1, In the R-igraph help it is stated: "In recent igraph versions, arbitrary R objects can be assigned as graph, vertex or edge attributes." I took this to mean that, for example, a vertex attribute could consist of vectors, matrices, lists, etc., but I can't seem to assign a vector as a vertex attribute, e.g. >g=graph.lattice(c(3,1)) >V(g)[1]$test = c(1,2,3,4) Warning message: In graph[[9]][[3]][[name]][index + 1] <- value : number of items to replace is not a multiple of replacement length > V(g)$test [1] NA 1 NA I've tried assigning pre-declared objects, e.g. >a= c(1,2,3,4..) >V(g)[1]$test = a and assignments to all vertices first (rather to a than a single vertex index), and I've tried to set the dim() on attributes, but so far I can't assign anything other than atomics. I can get around this with arrays that are referenced by vertex id, but it would be nice to integrate the info into the single graph data structure. Am I misinterpreting the package capabilities or making an obvious error (like somehow declaring the attribute class?) Thanks Dan Auerbach 970-491-2414 Graduate Degree Program in Ecology Dept. of Biology Colorado State Univ. Fort Collins, CO 80523-1878 |
[Prev in Thread] | Current Thread | [Next in Thread] |