Created
May 9, 2015 16:49
-
-
Save benjaminaaron/6f95c3dca98c124acd15 to your computer and use it in GitHub Desktop.
Trying to achieve a simple Tree-Layout with graphstream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.graphstream.graph.Graph; | |
import org.graphstream.graph.implementations.SingleGraph; | |
import org.graphstream.ui.layout.HierarchicalLayout; | |
import org.graphstream.ui.view.Viewer; | |
public class Simple { | |
public static void main(String[] args) { | |
Graph graph = new SingleGraph("Test"); | |
Viewer viewer = graph.display(); | |
HierarchicalLayout hl = new HierarchicalLayout(); | |
viewer.enableAutoLayout(hl); | |
graph.addNode("A" ); | |
graph.addNode("B" ); | |
graph.addNode("C" ); | |
graph.addNode("D" ); | |
graph.addEdge("AB", "A", "B"); | |
graph.addEdge("AC", "A", "C"); | |
graph.addEdge("CD", "C", "D"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment