Skip to content
Prev 303480 / 398506 Next

igraph: Turn multiple edges into weights

On Tue, Aug 14, 2012 at 5:09 PM, Jonas Michaelis
<jonas.michaelis at gmail.com> wrote:
simplify() by default sums the edge weights, so just set all weights
to 1, and call simplify().

E.g.

## A graph with multiple edges
g <- graph.formula(A:A:A -- B:C:D, A -- B, simplify=FALSE)
str(g)
E(g)$weight <- 1
g2 <- simplify(g, remove.loops=FALSE)
str(g2, e=TRUE)

Best,
Gabor