I'm trying to combine two graphs with the same nodes, but such that the new graph edge weight is the sum of the two original graphs (but of course want the solution to extend to N graphs):
g1 <- graph.empty(directed=FALSE) + vertices(letters[1:2])
g1 <- g1 + edge("a", "b")
E(g1)$weight <- 1
g2 <- graph.empty(directed=FALSE) + vertices(letters[1:2])
g2 <- g2 + edge("a", "b")
E(g2)$weight <- 2
g3 <- g1 %u% g2
E(g3)$weight_1 #this is 1
E(g3)$weight_2 #this is 2
But i want E(g3)$weight to be 3.
Is there a more elegant way of doing this than summing across the edge weights _1, _2, ... afterwards? Something along the lines of simplify/contract?