Java version of graphviz

Hi developers, just a share. I’m a Java developer and a graphviz user, I wrote a tiny version of graphviz in Java, I’m not sure if this is interesting :smile:: GitHub - jamisonjiang/graph-support: Java re-implementation of tiny graphviz

1 Like

Cool.
Can you describe (even at a high level) what parts of Graphviz you cover/reproduce (and what parts you don’t)?
I noticed good-looking “ortho” edges. Maybe Graphviz should reverse-engineer your code.

Briefly describe cover and not cover:

Input
only java api, still not support dot;

Output
svg and Java objects (to facilitate the program to extract some layout information)

Layout
only dot;

Graph Items
Node,Subgraph,Cluster,Graph;

Node
Some commonly used fixed shape and dynamic shape like record | mrecord | regular_polyline;

Line
Support NONE | ROUNDED | SPLINE | LINE | POLYLINE | ORTHO

Label
Support table structure;

In addition, since the api uses strongly typed Java, all the attributes that can be set represent all the features that can be supported, and the rest are not supported.

Ortho route In my test, I think graphviz does a better job in most cases, especially in the scene of separating line segments and avoiding bending. I compared some other projects that can perform Ortho layout. Graphviz I feel it’s the best.
In the implementation of graph-support, I think the only thing better than graphviz is the handling of labels, because I found that grahviz ortho does not seem to support labels, and labels are not always placed next to the lines. Other than that I feel that graphviz is always the better side of the Ortho route (in my tests).

Hi Jamison, that’s great!
We are about to add a GraphViz based visualizer in our Java project GitHub - kovzol/Java-Geometry-Expert: Java Geometry Expert.
It would be great to try out your project as a possible use case.
There is now a GraphViz export but we would like to show the graphical output directly in the application. Of course, the program should work on multiple platforms (Windows, Mac, Linux). So it is crucial to use a platform independent solution.
Do you think your library could be an option?
Thanks, Zoltan

graph-support zero dependency and we can use batik to transform SVG to any image format, I think it’s ok for multi-platform.

1 Like

This indeed works, thanks for the idea. Now the latest version of JGEX (Release 0.80-20231101 · kovzol/Java-Geometry-Expert · GitHub) uses graph-support and batik to visualize geometry proofs.

2 Likes

The latest version can draw image without batik and support multi platform, it is more simple to integrate.

1 Like