[BioC] Rgraphviz weight attributes

Robert M. Flight rflight79 at gmail.com
Wed Apr 6 21:56:16 CEST 2011


Hi All,

Have some questions about the Rgraphviz package and attributes that
are being passed. I want to weight some edges in my graph based on
some attributes. So to verify that this should be possible, I created
a simple graph and used "fdp" when weights are present and when they
are not, all from the command line, so I know what *should* be
happening.

"noweight.txt"
graph G {
	A -- B [weight=1];
	A -- C [weight=1];
	C -- B [weight=1];
}

fdp -Tjpg noweight.txt -o noweight.jpg

This results in this:
http://bioinformatics.louisville.edu/robert/graphViz_images/noweight.jpg

"weight_BC.txt"
graph G {
	A -- B [ weight=.1];
	A -- C [ weight=.1];
	C -- B [ weight=1];
}

fdp -Tjpg weight_BC.txt -o weight_BC.jpg

Results in: http://bioinformatics.louisville.edu/robert/graphViz_images/weight_BC.jpg

This is what I expect, I weight an edge higher, and the nodes are
pushed together a little more.

So I decide to try this in R:

library(Rgraphviz)
g1 <- new("graphNEL",nodes=c('A','B','C'),edgeL=list(A=c('B','C'),B=c('A','C'),C=c('A','B')),edgemode="undirected")
edgeAttrs <- list(weight=list('A~B'=1,'A~C'=1,'B~C'=10))
g2 <- agopen(g1, name='test',layoutType="fdp")
plot(g2)

## Gives me: http://bioinformatics.louisville.edu/robert/graphViz_images/noweight_R.png

g3 <- agopen(g1, name='test',edgeAttrs=edgeAttrs,layoutType="fdp")
plot(g3)
## Gives: http://bioinformatics.louisville.edu/robert/graphViz_images/weight_BC_R.png

This is not what I expected. From everything I can tell, the edge
attributes are defined correctly. Is there something in the Rgraphviz
code that does not recognize weights? Or is there something more at
work here. Any insights would be very much appreciated.

sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United
States.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets
methods   base

other attached packages:
[1] Rgraphviz_1.28.0 graph_1.28.0

loaded via a namespace (and not attached):
[1] tools_2.12.1

Thanks,

-Robert

Robert M. Flight, Ph.D.
University of Louisville Bioinformatics Laboratory
University of Louisville
Louisville, KY

PH 502-852-1809 (HSC)
PH 502-852-0467 (Belknap)
EM robert.flight at louisville.edu
EM rflight79 at gmail.com

Williams and Holland's Law:
       If enough data is collected, anything may be proven by
statistical methods.



More information about the Bioconductor mailing list