[prev in list] [next in list] [prev in thread] [next in thread]
List: graphviz-interest
Subject: Re: [graphviz-interest] automatic layout for Grappa
From: Jan Sanders <jan () rvs ! uni-bielefeld ! de>
Date: 2010-07-21 10:56:15
Message-ID: 4C46D24F.7040900 () rvs ! uni-bielefeld ! de
[Download RAW message or body]
Hi Jean,
junghee@cs.umass.edu wrote:
> Hi Jan Sanders,
>
> Thank you for your response! Can I ask two questions?
Of course.
>
> First, as far as I know Grappa does not support generating the image
> file (e.g. bmp), right?
That is true.
> (Is it hard work to implement such functionality?)
No. Just use java.lang.Runtime.exec to execute
dot -T<format> -o outfile
then use the java.lang.Process object created by the exec call to feed
your att.grappa.Graph to the dot process. The result file will be where
you specified it using "-o outfile"
Small example.
// use your Graph object for this
Graph g = getGraphFromSomewhere();
// Get a Runtime object so that you can execute commands
Runtime r = Runtime.getRuntime();
// Execute dot and specify the target output file, type of output and
everything that you could as if
// you were calling dot from the command line.
Process p = Runtime.exec("/usr/bin/dot -Tpng -o /home/user/output.png");
// Feed the Graph data to the dot process
// this will write the Graph data to stdin of the dot process
g.printGraph(p.getOutputStream);
// don't forget to flush. ;-)
p.getOutputStream().flush();
>
> Second, could you please let me know how I can set the compile option
> you mentioned, like "dot -o layouted-graph.dot graph.dot"? FYI,
> currently I am using the eclipse.
The exec call is stated as a String. No IDE specifics here. As for the
dot specific flags see http://www.graphviz.org/Documentation.php
Mind, that the command string used in Runtime.exec is not platform
independent.
Hope I could help.
Jan Sanders
_______________________________________________
graphviz-interest@research.att.com
https://mailman.research.att.com/mailman/listinfo/graphviz-interest
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic