[R] Graph in R with edge weights

Ivan Alves papucho at me.com
Wed Dec 1 19:19:18 CET 2010


Hi Arthur,

I was asking the same thing and came across the following (your need the "sna" library).

http://students.washington.edu/mclarkso/documents/gplot%20Ver2.pdf

Take a look at the edge.lwd and vertex.cex examples of the function gplot. You can use vectors for the different nodes.

Kind regards,
Ivan
On Dec 1, 2010, at 9:31 AM, arturs.onzuls at gmail.com wrote:

> Can you please show code example, how to draw graph with some nodes and
> edges, but with weights. I only found here
> http://www.bioconductor.org/packages/release/bioc/vignettes/Rgraphviz/inst/doc/Rgraphviz.pdf-
> Using edge weights for labels, but...
> 
> Here an example:
> 
>> library("graph"); library(Rgraphviz)
>> myNodes = c("s", "p", "q", "r")
>> myEdges = list(
> s = list(edges = c("p", "q")),
> p = list(edges = c("p", "q")),
> q = list(edges = c("p", "r")),
> r = list(edges = c("s")))
>> g = new("graphNEL", nodes = myNodes,
> edgeL = myEdges, edgemode =
> "directed")
>> plot(g)
> 
> but how about weights?
> 
> 
> Thanx.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list