Problem using Rgraphviz (edge weights going missing).
Entering edit mode
Dan Bolser ▴ 40
Last seen 7.2 years ago
Hi all, After successfully installing Rgraphviz on this Centos 5.2 (RHEL 4) box (basically with yum install *graphviz*** ..., then using the standard BioC install procedure) and then navigating the packaging error (that actually caused R to crash) described here: (Just manually run dot -c as root) I finally got to produce some nice graphs of my data. However, I found that when I tried to write my graphs to file in dot format, the edge weights go missing. I load my graph like this: library(Rgraphviz) myNodes <- paste(nodes$MAPC) myG <- new("graphNEL", nodes=myNodes) for(i in 1:nrow(dat)){ paste(dat[i,"A"], dat[i,"B"]) myG <- addEdge(paste(dat[i,"A"]), paste(dat[i,"B"]), myG, dat[i,"N"]) } plot(myG, "neato") and all well and good (except that I couldn't get the edge weights to translate into line thickness - more on that below). Then I (foolishly?) tried: agwrite(agopen(myG,"test"), filename="test") This produced a file, but the weight attribute of the edges (in dot format?) were all clearly set to 1 (and not the range of values that I have stored in dat$N). I confirmed that my loop was putting the weights somewhere with the following one-liner: lapply(myG at edgeData@data, function(l){l$weight}) but I don't really know what this means. So I think its a bug. The graph should be written to file with the correct weight attributes. AFAICT. Poking around in the data structure I was confused by the apparent number of edges... ew <- unlist(edgeWeights(myG)) length(ew) Why is this not equal to the number of edges that I put in (and the number reported by just printing the graph object)? I tried to set the width of the edges plotted on the graph by using the penwidth attribute, but it had no effect, and was not written to file as an attribute of the graph. ## Try defining some EDGE attributes eAttrs <- list() ## Get the edge weights ew <- unlist(edgeWeights(myG)) length(ew) ## Some need removing for some reason somehow... ew <- ew[setdiff(seq(along = ew), removedEdges(myG))] length(ew) ## Label the attributes vector (so it can be used properly) names(ew) <- edgeNames(myG) eAttrs$penwidth <- ew plot(myG, "neato", edgeAttrs=eAttrs) toFile(agopen(myG, name="test"), filename="test", edgeAttrs=eAttrs) So I read in the vignette, " A list of all available attributes is accessible online at: html. Note that there are some di?erences between default values and also some attributes will not have an e?ect in Rgraphviz. Please see the man page for graphvizAttributes for more details." Where is the "man page for graphvizAttributes for more details" ?? It would be good to know what attributes Rgraphviz is ignoring and if penwidth is one of them in particular. Also the vignette didn't tell me who to contact in case of feedback, bugs, questions, etc. Who else should I be bugging with this email? Thanks for reading! Dan. -- R2spec --bioc -u z_1.18.1.tar.gz
GO graph Rgraphviz GO graph Rgraphviz • 965 views

Login before adding your answer.

Traffic: 488 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6