On Tue, Aug 14, 2012 at 5:09 PM, Jonas Michaelis <jonas.michae...@gmail.com> wrote: > Dear all, > > > I have some network data - about 300 vertices and several thousand edges. I > am looking for a way to turn multiple edges into weights of the edges. I > looked around and - surprisingly? - haven't found anything. Is there an > easy way to do this?
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 > > Best, Jonas > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Gabor Csardi <csa...@rmki.kfki.hu> MTA KFKI RMKI ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.