I wrote a little graph visualizer class:
public void simpleGraph(SparseMultigraph<Vertex,SEdge> graph, String name) {
Layout<Vertex, SEdge> layout = new ISOMLayout(graph);
layout.setSize(new Dimension(800,800));
BasicVisualizationServer<Vertex, SEdge> vv = new BasicVisualizationServer<Vertex, SEdge>(layout);
vv.setPreferredSize(new Dimension(850,850)); //Sets the viewing area size
JFrame frame = new JFrame(name);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(vv);
frame.pack();
frame.setVisible(true);
}
How can I add labels for vertices and edges? The Values are stored in my custom vertex class. Can I iterate over all vertices in the Layout or BasicVisualizationServer and add labels?
Thanks for your help!