[BioC] Problem using Rgraphviz (edge weights going missing).

Dan Bolser dan.bolser at gmail.com
Wed Oct 22 16:54:25 CEST 2008

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:


myNodes <-

myG <- new("graphNEL", nodes=myNodes)

for(i in 1:nrow(dat)){
  paste(dat[i,"A"], dat[i,"B"])
  myG <-
            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.

Poking around in the data structure I was confused by the apparent
number of edges...

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 <-

## Some need removing for some reason somehow...
ew <-
  ew[setdiff(seq(along = ew), removedEdges(myG))]

## Label the attributes vector (so it can be used properly)
names(ew) <-

eAttrs$penwidth <-

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: http://www.graphviz.org/pub/scm/graphviz2/doc/info/attrs.
html. Note that there are some differences between default values and also
some attributes will not have an effect 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!



R2spec --bioc -u

More information about the Bioconductor mailing list