> The short explanation is that I would like to do some math involving the > vertex and edge attribute values of two graphs.
[…] > > I can construct an attrib name variable: > > attrib <- list.vertex.attributes(gA) > > ...but the problem I seem to be having is constructing the combined 'total' > attribute which involves indexing over the names of all the attributes, for > example: V(gA)$attrib[i] e.g. V(gA)$(area[i], aspect[i], ..., Ot[i])[i]. You could try constructing a data frame that contains the vertex attributes in the columns and the vertices in the rows, and then use apply() to apply a function to each row in the data frame: g <- grg.game(100, 0.2) V(g)$a <- 1:100 V(g)$b <- 100:100 df <- data.frame(a=V(g)$a, b=V(g)$b) V(g)$total <- apply(df, 1, my.combinator.function) where my.combinator.function must be your combinator function. T. _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
