Rgraphviz: how to read a \"dot\" file?
3
0
Entering edit mode
Guest User ★ 13k
@guest-user-4897
Last seen 9.7 years ago
The Rgraphviz package index says nothing about reading "dot" files. (it has "toFile" to write them but no fromFile). How do I create an Ragraph object? (either by reading a dot file or from a list of edges with weights and vertices with names and other attributes). -- output of sessionInfo(): Thanks! -- Sent via the guest posting facility at bioconductor.org.
Rgraphviz Rgraphviz • 5.3k views
ADD COMMENT
0
Entering edit mode
@vincent-j-carey-jr-4
Last seen 7 weeks ago
United States
try agread() probably needs more doc On Mon, Oct 15, 2012 at 4:16 PM, Sam [guest] <guest@bioconductor.org> wrote: > > The Rgraphviz package index says nothing about reading "dot" files. > (it has "toFile" to write them but no fromFile). > How do I create an Ragraph object? > (either by reading a dot file or from a list of edges with weights and > vertices with names and other attributes). > > > -- output of sessionInfo(): > > > Thanks! > > -- > Sent via the guest posting facility at bioconductor.org. > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
On 10/15/2012 01:36 PM, Vincent Carey wrote: > try agread() > > probably needs more doc I added some to the devel version of Rgraphviz, including: Read / write Ragraph objects Description: These functions will write an 'Ragraph' object to or from a file. Usage: agwrite(graph, filename) agread(filename, layoutType="dot", layout=TRUE) Arguments: graph: An object of class 'Ragraph' filename: The input or output filename layoutType: character(1) specifying the format of the input file. Must be one of 'graphvizCapabilities()$layoutTypes'. layout: logical(1) indicating whether 'graphLayout' is to be called on the result of file input. Details: These function are wrappers to agwrite() and agread() calls in Graphviz. Author(s): Jeff Gentry See Also: 'agopen', 'agread' Examples: V <- letters[1:10] M <- 1:4 g1 <- randomGraph(V, M, .2) z <- agopen(g1, "foo", layout=FALSE) ## default layoutType 'dot' file <- tempfile() agwrite(z, file) ## supported input types graphvizCapabilities()$layoutTypes g2 <- agread(file, layout=TRUE) if (interactive()) plot(g2) > > On Mon, Oct 15, 2012 at 4:16 PM, Sam [guest] <guest at="" bioconductor.org=""> wrote: > >> >> The Rgraphviz package index says nothing about reading "dot" files. >> (it has "toFile" to write them but no fromFile). >> How do I create an Ragraph object? >> (either by reading a dot file or from a list of edges with weights and >> vertices with names and other attributes). >> >> >> -- output of sessionInfo(): >> >> >> Thanks! >> >> -- >> Sent via the guest posting facility at bioconductor.org. >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at r-project.org >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793
ADD REPLY
0
Entering edit mode
Thanks Vince and Martin Kasper On Mon, Oct 15, 2012 at 9:47 PM, Martin Morgan <mtmorgan at="" fhcrc.org=""> wrote: > On 10/15/2012 01:36 PM, Vincent Carey wrote: >> >> try agread() >> >> probably needs more doc > > > I added some to the devel version of Rgraphviz, including: > > Read / write Ragraph objects > > Description: > > These functions will write an 'Ragraph' object to or from a file. > > Usage: > > agwrite(graph, filename) > agread(filename, layoutType="dot", layout=TRUE) > > Arguments: > > graph: An object of class 'Ragraph' > > filename: The input or output filename > > layoutType: character(1) specifying the format of the input file. Must > be one of 'graphvizCapabilities()$layoutTypes'. > > layout: logical(1) indicating whether 'graphLayout' is to be called > on the result of file input. > > Details: > > These function are wrappers to agwrite() and agread() calls in > Graphviz. > > Author(s): > > Jeff Gentry > > See Also: > > 'agopen', 'agread' > > Examples: > > V <- letters[1:10] > M <- 1:4 > g1 <- randomGraph(V, M, .2) > z <- agopen(g1, "foo", layout=FALSE) ## default layoutType 'dot' > file <- tempfile() > agwrite(z, file) > > > ## supported input types > graphvizCapabilities()$layoutTypes > g2 <- agread(file, layout=TRUE) > if (interactive()) > plot(g2) > > >> >> On Mon, Oct 15, 2012 at 4:16 PM, Sam [guest] <guest at="" bioconductor.org=""> >> wrote: >> >>> >>> The Rgraphviz package index says nothing about reading "dot" files. >>> (it has "toFile" to write them but no fromFile). >>> How do I create an Ragraph object? >>> (either by reading a dot file or from a list of edges with weights and >>> vertices with names and other attributes). >>> >>> >>> -- output of sessionInfo(): >>> >>> >>> Thanks! >>> >>> -- >>> Sent via the guest posting facility at bioconductor.org. >>> >>> _______________________________________________ >>> Bioconductor mailing list >>> Bioconductor at r-project.org >>> https://stat.ethz.ch/mailman/listinfo/bioconductor >>> Search the archives: >>> http://news.gmane.org/gmane.science.biology.informatics.conductor >>> >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at r-project.org >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> > > > -- > Computational Biology / Fred Hutchinson Cancer Research Center > 1100 Fairview Ave. N. > PO Box 19024 Seattle, WA 98109 > > Location: Arnold Building M1 B861 > Phone: (206) 667-2793 > > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY
0
Entering edit mode
@sam-steingold-5553
Last seen 9.7 years ago
> * Vincent Carey <fgiwp at="" punaavat.uneineq.rqh=""> [2012-10-15 16:36:04 -0400]: > > try agread() Thanks for your kind reply. Alas, I have encountered two problems with this function: 1. unlike all the other R functions, it does not understand "~" in filenames: Error in agread("~/xgraph/share-click/2012-10-09/country-graph.dot") : Requested file does not exit 2. when I manually expand the path, it segfaults: *** caught segfault *** address 0x18, cause 'memory not mapped' Traceback: 1: graphLayout(g) 2: agread("/home/sds/xgraph/share-click/2012-10-09/country- graph.dot") sessionInfo: R version 2.15.1 (2012-06-22) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] C attached base packages: [1] stats graphics grDevices utils datasets compiler methods [8] base loaded via a namespace (and not attached): [1] tools_2.15.1 The dot file in question was written by igraph: -------------- next part -------------- -- Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000 http://www.childpsy.net/ http://think-israel.org http://ffii.org http://iris.org.il http://thereligionofpeace.com http://pmw.org.il To iterate is human; to recurse, divine.
ADD COMMENT
0
Entering edit mode
On Tue, Oct 16, 2012 at 12:51 AM, Sam Steingold <sds at="" gnu.org=""> wrote: >> * Vincent Carey <fgiwp at="" punaavat.uneineq.rqh=""> [2012-10-15 16:36:04 -0400]: >> >> try agread() > > Thanks for your kind reply. > Alas, I have encountered two problems with this function: > > 1. unlike all the other R functions, it does not understand "~" in > filenames: > Error in agread("~/xgraph/share-click/2012-10-09/country-graph.dot") : Requested file does not exit This should be easy to fix, thanks. > 2. when I manually expand the path, it segfaults: > > *** caught segfault *** > address 0x18, cause 'memory not mapped' > > Traceback: > 1: graphLayout(g) > 2: agread("/home/sds/xgraph/share-click/2012-10-09/country- graph.dot") Can you send me the dot file? The segfault probably comes from Graphviz, suggesting that igraph has produced an invalid file. It would of course be nice for us to catch the exception, but I am not sure I have resources to fix this. Kasper > > sessionInfo: > R version 2.15.1 (2012-06-22) > Platform: x86_64-pc-linux-gnu (64-bit) > > locale: > [1] C > > attached base packages: > [1] stats graphics grDevices utils datasets compiler methods > [8] base > > loaded via a namespace (and not attached): > [1] tools_2.15.1 > > The dot file in question was written by igraph: > > > > > -- > Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000 > http://www.childpsy.net/ http://think-israel.org http://ffii.org > http://iris.org.il http://thereligionofpeace.com http://pmw.org.il > To iterate is human; to recurse, divine. > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY
0
Entering edit mode
@sam-steingold-5553
Last seen 9.7 years ago
> * Kasper Daniel Hansen <xunafra at="" wufcu.rqh=""> [2012-10-16 11:23:35 -0400]: > >> 2. when I manually expand the path, it segfaults: >> >> *** caught segfault *** >> address 0x18, cause 'memory not mapped' >> >> Traceback: >> 1: graphLayout(g) >> 2: agread("/home/sds/xgraph/share-click/2012-10-09/country- graph.dot") > > Can you send me the dot file? The segfault probably comes from > Graphviz, suggesting that igraph has produced an invalid file. It > would of course be nice for us to catch the exception, but I am not > sure I have resources to fix this. I attached the file to the message you are replying to, but, apparently, bioconductor stripped it. Here you go again: -------------- next part -------------- PS. I CCed the message to the igraph mailing list to ensure that they are in the loop. -- Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000 http://www.childpsy.net/ http://ffii.org http://openvotingconsortium.org http://iris.org.il http://www.memritv.org http://honestreporting.com I don't like cats! -- Come on, you just don't know how to cook them!
ADD COMMENT
0
Entering edit mode
On Tue, Oct 16, 2012 at 12:41 PM, Sam Steingold <sds at="" gnu.org=""> wrote: >> * Kasper Daniel Hansen <xunafra at="" wufcu.rqh=""> [2012-10-16 11:23:35 -0400]: >> >>> 2. when I manually expand the path, it segfaults: >>> >>> *** caught segfault *** >>> address 0x18, cause 'memory not mapped' >>> >>> Traceback: >>> 1: graphLayout(g) >>> 2: agread("/home/sds/xgraph/share-click/2012-10-09/country- graph.dot") >> >> Can you send me the dot file? The segfault probably comes from >> Graphviz, suggesting that igraph has produced an invalid file. It >> would of course be nice for us to catch the exception, but I am not >> sure I have resources to fix this. Yes, it might be an igraph bug, as http://www.graphviz.org/doc/info/lang.html says that node ids cannot start with numbers and the files igraph exports they are just numbers. I am wondering how this ever worked. Gabor [...]
ADD REPLY
0
Entering edit mode
On Tue, Oct 16, 2012 at 3:18 PM, G?bor Cs?rdi <csardi at="" rmki.kfki.hu=""> wrote: [...] > Yes, it might be an igraph bug, as > http://www.graphviz.org/doc/info/lang.html says that node ids cannot > start with numbers and the files igraph exports they are just numbers. > I am wondering how this ever worked. Well, I was a little too quick. Numbers are actually allowed as IDs in dot files. So I have no idea why the file should be invalid. Gabor [...]
ADD REPLY
0
Entering edit mode
I have fixed the ~ issue in Rgraphviz devel. I have provided a couple of checks that catches trying to plot a graph with zero number of edges, but idoes not fix the issue of agreed(layout = TRUE) which is the default and which caused the segfault. Fixing this requires more tinkering due to the class hierarchy. Since I kind of want to fix the class hierarchy anyway in Rgraphviz, I have decided to postpone this. I still believe that the file is somehow invalid because it is not being parsed by dot from Graphviz, so I consider this to be an igraph problem. Kasper On Tue, Oct 16, 2012 at 3:25 PM, G?bor Cs?rdi <csardi at="" rmki.kfki.hu=""> wrote: > On Tue, Oct 16, 2012 at 3:18 PM, G?bor Cs?rdi <csardi at="" rmki.kfki.hu=""> wrote: > [...] >> Yes, it might be an igraph bug, as >> http://www.graphviz.org/doc/info/lang.html says that node ids cannot >> start with numbers and the files igraph exports they are just numbers. >> I am wondering how this ever worked. > > Well, I was a little too quick. Numbers are actually allowed as IDs in > dot files. So I have no idea why the file should be invalid. > > Gabor > > [...]
ADD REPLY
0
Entering edit mode
I got the files, thanks. I can confirm the crash, but I also get > tmp = agread("country-graph.dot", layout = FALSE) > tmp [1] "A graph with 0 nodes." (it crashes with layout=TRUE, presumably because it thinks there are zero nodes). I also get a crash when I used command-line dot from Graphviz 2.28.0. I'll look some more, but my guess still stands: it is an invalid dot file. Kasper On Tue, Oct 16, 2012 at 12:41 PM, Sam Steingold <sds at="" gnu.org=""> wrote: >> * Kasper Daniel Hansen <xunafra at="" wufcu.rqh=""> [2012-10-16 11:23:35 -0400]: >> >>> 2. when I manually expand the path, it segfaults: >>> >>> *** caught segfault *** >>> address 0x18, cause 'memory not mapped' >>> >>> Traceback: >>> 1: graphLayout(g) >>> 2: agread("/home/sds/xgraph/share-click/2012-10-09/country- graph.dot") >> >> Can you send me the dot file? The segfault probably comes from >> Graphviz, suggesting that igraph has produced an invalid file. It >> would of course be nice for us to catch the exception, but I am not >> sure I have resources to fix this. > > I attached the file to the message you are replying to, but, apparently, > bioconductor stripped it. > Here you go again: > > > PS. I CCed the message to the igraph mailing list to ensure that they > are in the loop. > > -- > Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000 > http://www.childpsy.net/ http://ffii.org http://openvotingconsortium.org > http://iris.org.il http://www.memritv.org http://honestreporting.com > I don't like cats! -- Come on, you just don't know how to cook them! > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY

Login before adding your answer.

Traffic: 764 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6