The short explanation is that I would like to do some math involving the vertex
and edge attribute values of two graphs.
Focusing on the vertices for now, assume I have two graphs, vcount(gA)=8,
vcount(gB) =5. Each vertex has a vector of attributes.
attribute_names<-c('area', 'aspect','TC', 'GS', 'BS', 'Wa', 'Bl', 'RR', 'Ot')
V(gA)$area <- c(1.1,2.06,0.67,0.64,0.82,1.29,0.84,0.82)
V(gA)$aspect <- c(0.31,0.39,0.47,0.57,0.29,0.44,0.37,0.35)
V(gA)$TC <- c(0.01,0.06,0.01,0.05,0.01,0.02,0.14,0.11)
V(gA)$GS <- c(0.18,0.03,0.32,0.18,0.19,0.1,0.08,0.2)
V(gA)$BS <- c(0.2,0.23,0.26,0.35,0.08,0.4,0.18,0.28)
V(gA)$Wa <- c(0.05,0,0.01,0.02,0.02,0.02,0.06,0.03)
V(gA)$Bl <- c(0.01,0.03,0.05,0.02,0.02,0,0.03,0.03)
V(gA)$RR <- c(0.09,0.07,0.02,0,0,0.14,0.02,0.03)
V(gA)$Ot <- c(0.47,0.57,0.34,0.38,0.67,0.31,0.49,0.32)
V(gB)$area <- c(0.97,1.29,0.8,0.6,1.17)
V(gB)$aspect <- c(0.43,0.44,0.43,0.48,0.46)
V(gB)$TC <- c(0.11,0.02,0.13,0.03,0.07)
V(gB)$GS <- c(0.11,0.1,0.07,0.22,0.08)
V(gB)$BS <- c(0.36,0.4,0.29,0.12,0.11)
V(gB)$Wa <- c(0.03,0.02,0.07,0.05,0.04)
V(gB)$Bl <- c(0.13,0,0.08,0.02,0.01)
V(gB)$RR <- c(0.02,0.14,0.01,0.11,0.03)
V(gB)$Ot <- c(0.24,0.31,0.35,0.44,0.66)
What I would like to do is combine the attributes at each node into a single
numerical vector. Using the above values, the result would be something like:
V(gA)$total[1] = (1.1,0.3,0.01, 0.18, 0.2, 0.05, 0.01, 0.09, 0.47) and
V(gB)$total[1] = (0.97, 0.43, 0.11, 0.11, 0.36, 0.03, 0.13, 0.02, 0.34).
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].
Any suggestions on how to combine the attributes on a single node would be
appreciated.
...David
Sent from my iPad_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help