(JavaFX) SmartGraph
This project provides a generic (Java FX) graph visualization library that can automatically arrange the vertices' locations through a force-directed algorithm in real-time.
You can, instead, statically place the vertices according to other algorithms.
Vertices and edges can be styled through a css stylesheet or programmatically (even at runtime).
Prerequisites
You need a working JDK with JavaFX libraries to compile/use the library. The code was tested with JDK 8 and OpenJDK 11.
Using the library
Check the releases folder for compiled library and source code. The jar library is the only requirement, but if you need to attach the javadoc and source code in your IDE, additionally use the zip file.
The visualization library can be used together with any ADT that adheres to the Graph or Digraph interfaces. Sample implementations are included.
Accelerated graphics
Since the visualization is computation-intensive during automatic force-directed layout of vertices, you should make sure that the graphics card is used to offload much of the work. This is only guaranteed to work with Oracle's JDK.
In windows the JVM machine should automatically take care of that, while in Linux you must configure it manually with the -Dsun.java2d.opengl=True flag.
Getting Started
Basic usage
//create the graph
Graph g = new GraphEdgeList<>();
//... see example below
SmartPlacementStrategy strategy = new SmartCircularSortedPlacementStrategy();
SmartGraphPanel graphView = new SmartGraphPanel<>(g, strategy);
Scene scene = new Scene(graphView, 1024, 768);
Stage stage = new Stage(StageStyle.DECORATED);
stage.setTitle("JavaFXGraph Visualization");
stage.setScene(scene);
stage.show();
//IMPORTANT - Called after scene is displayed so we can have width and height values
graphView.init();
This will