Re: canviz

39 views
Skip to first unread message

Ryan Schmidt

unread,
Jul 21, 2010, 4:05:30 AM7/21/10
to can...@googlegroups.com, Walter Schulze

On Jul 19, 2010, at 16:10, Walter Schulze wrote:

> I am sorry, but I am not finding the link to the discussion group topic where you posted my email?

Hmm, neither can I! It should be here but it's not:

http://groups.google.com/group/canviz/topics

I'm not sure why it's not in the archives, since I did send it to the discussion group, and the discussion group did send a copy of it back to my email address.

If this reply also fails to show up on the list, please create a new discussion on the list with your reply.


> Actually I was wondering why you are using dot.exe and you have not embedded the actual code into the javascript so that it can all be done client side?
>
> I have now also seen that although DOT2GWTCanvas can parse a dot file, the positions of the nodes have to be specified. I think that kind of defies the point.
>
> So seems I am still looking for a solution :(

I'm not familiar with DOT2GWTCanvas, but that sounds like how Canviz works as well: the node positions, edge curves, and in fact the entire drawing commands need to be specified in the dot file. This information is added to a dot file by running it through one of the Graphviz layout programs (i.e. dot, neato, etc.) with the -Txdot argument.

Graphviz is actually a very large program, which has been in development for over twenty years. It's written in C and C++, which are compiled languages. And it makes use of a dozen or more libraries, which are also written in C or C++, to handle a variety of different issues. Some of these are optional, depending on how you're going to use Graphviz, but I'm guessing at least a few are required. On the web, we can only run JavaScript, which is not compiled but interpreted, which means it runs slower. (Well, Java and Flash are possibilities too, but I'm not interested in using those here.) JavaScript also has a different object oriented programming model than C++. So converting a large program like Graphviz and the libraries it needs from C and C++ into JavaScript would be a colossal undertaking, and would likely result in something that runs slower than the real Graphviz. And this port would need to be kept updated every time Graphviz changes in some way. So for these reasons I have no interest in pursuing this idea, and I don't see why anyone would want to do it, either, since it's not hard to install Graphviz on a server and use it from there.


Ron Newman

unread,
Jul 21, 2010, 10:32:43 AM7/21/10
to can...@googlegroups.com
Ryan,
I also assumed that graphviz would be too slow to run in Javascript, and like you, I have no interest in flash or java.  But DOT2GWTCanvas runs crisply, and after seeing it I'm re-thinking the possibilities.  I had a conversation with the developer of DOT2GWTCanvas for awhile.  Maybe someone is already maintaining a port of Graphviz to Java, at which point using GWT (Google Web Toolkit) becomes feasible to convert it automatically to Javascript without having to re-code.  We would probably still want to strip out unused portions of Graphviz that aren't needed in an interactive environment such as Canviz, even customize for a subset of graphs ( leaving out html-like labels, or record nodes, or cycle-intensive algorithms like neato ).

Another possibility is to use prefuse.org, on which Graphviz is based and which is already in Java, but I haven't looked into it and assume it doesn't take dot language as input or export xdot language.  Maybe some translations are possible?

Ron

Ryan Schmidt

unread,
Jul 26, 2010, 2:17:40 PM7/26/10
to Walter Schulze, can...@googlegroups.com
On Jul 26, 2010, at 03:25, Walter Schulze wrote:

> On 21 July 2010 10:05, Ryan Schmidt wrote:
>
>> I'm not familiar with DOT2GWTCanvas, but that sounds like how Canviz works as well: the node positions, edge curves, and in fact the entire drawing commands need to be specified in the dot file. This information is added to a dot file by running it through one of the Graphviz layout programs (i.e. dot, neato, etc.) with the -Txdot argument.
>

> Sorry I thought you were familiar with it, given that you commented on it:
> https://mailman.research.att.com/pipermail/graphviz-interest/2010q1/006891.html

Ah yes, I had forgotten. I had glanced at it briefly.


>> Graphviz is actually a very large program, which has been in development for over twenty years. It's written in C and C++, which are compiled languages. And it makes use of a dozen or more libraries, which are also written in C or C++, to handle a variety of different issues. Some of these are optional, depending on how you're going to use Graphviz, but I'm guessing at least a few are required. On the web, we can only run JavaScript, which is not compiled but interpreted, which means it runs slower. (Well, Java and Flash are possibilities too, but I'm not interested in using those here.) JavaScript also has a different object oriented programming model than C++. So converting a large program like Graphviz and the libraries it needs from C and C++ into JavaScript would be a colossal undertaking, and would likely result in something that runs slower than the real Graphviz. And this port would need to be kept updated every time Graphviz changes in some way. So for these reasons I have no interest in pursuing this idea, and I don't see why anyone would want to do it, either, since it's not hard to install Graphviz on a server and use it from there.
>

> You have a good point, I didn't realize Graphviz was such a huge program.
> I still think I can probably program a smaller less effective, but acceptable graph layout algorithm.
> I just have not found any good links explaining graph layout algorithms, but I am still searching.
>
> The reason why I want to do this, is because I want to run my application on google app engine and google web toolkit. This means I can program in java and the client side code gets coverted to javascript for me by the google web toolkit compiler. Unfortunately the Google App Engine (Server side) does not allow me to run just anything. It has to be java code and the libraries I use must be on google white list of approved libraries.
>
> The advantages are free web hosting if you are small and scalability if you get huge. And it is very nice to program in java, versus 'n scripting language.
>
> Thank you for all your time.
> And good luck with all your future endeavors.

Thanks. In fact about 5 or 6 years ago I had looked into writing my own graph layout algorithms. I thought, how hard could it be? Then I realized it was a great deal harder than I thought, and a quick search to see what was already out there led me to Graphviz, which I've been using ever since. If you want to use Canviz for display but want to write your own graph layout algorithms instead of using Graphviz, that should be possible, so long as your algorithm produces a valid xdot file as output. The xdot format is described in detail here:

http://www.graphviz.org/doc/info/output.html#d:xdot

And of course you can create as many sample outputs from the real Graphviz as you need to see how it handles various situations.

On the main Graphviz documentation page there are also some papers on graph drawing, including a 1993 paper describing the Graphviz dot algorithm.

http://www.graphviz.org/Documentation.php

I personally have no interest in writing Java code, but I understand the appeal of using Google's services. The alternative may be to make use of a Graphviz web service to do your graph rendering, instead of trying to do it by running local code. One such service has already been announced on the Graphviz mailing lists, and I still have plans to start one at some time in the future as well.

https://mailman.research.att.com/pipermail/graphviz-interest/2010q2/007062.html

I have not tried this API so I don't know how applicable it would be to what you want to do.

If you want to host the majority of your application on Google but set up a server just to render graphs, you can use a script like webdot on that server to provide a web interface to that. There's the tcl version of webdot here:

http://www.graphviz.org/Download_source.php

And the IMHO slightly more usable perl version of webdot here:

http://www.graphviz.org/Misc/webdot.pl

For my own eventually upcoming service, I plan to write a third version of webdot, in PHP, because I am more familiar with that language.


Ron Newman

unread,
Jul 26, 2010, 3:05:19 PM7/26/10
to can...@googlegroups.com
Walter,
I've been thinking for a few months that just what you describe - a GWT port of Graphviz with Canviz as a renderer - would be ideal.  But not being a java programmer I haven't tackled it.  Please keep the group informed if you take it on.

Ron
Reply all
Reply to author
Forward
0 new messages