I was playing around with graphstream with a small compiler I'm writing to create an Abstract-Syntax-Tree visualization, like this:
// ASTNode is the root to to the AST tree. Given that node, this just displays
// the AST on-screen.
public static void visualize(ASTNode ast) throws IOException, URISyntaxException {
Path file = Path.of(VisualizeAbstractSyntaxTree.class.getResource("graph.css").toURI());
String css = Files.readString(file);
System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
Graph graph = new SingleGraph("AST");
graph.addAttribute("ui.stylesheet", css);
construct(ast, "0", graph); // construct the tree from the AST root node.
Viewer viewer = graph.display();
}
Running the program shows the auto positioning magic. However, when a node is dragged by the mouse the other nodes remain stationary. Is there an easy way to get the other nodes to react (also pulled) if a node is dragged with the mouse?
This must be supported, but I cannot seem to find any examples or API references to this?