1
votes

I have a multigraph, and I would like to be able to see each edge that goes from one vertex to another clearly. For example, when I have a graph with 2 vertices, and 2 edges going from the first to the second, I would like to see 2 arrows going from the first node to the second, instead of the arrows overlapping.

This is my code currently, and you can see that I'm trying to have 2 edges connecting A and B:

import org.graphstream.graph.*;
import org.graphstream.graph.implementations.*;
import org.graphstream.ui.swingViewer.Viewer;

public class Tutorial1 {
    public static void main(String args[]) {
        Graph graph = new MultiGraph("Test");

        graph.addNode("A");
        graph.addNode("B");


        graph.addEdge("1", "A", "B", true);
        graph.addEdge("2", "A", "B", true);

        Viewer viewer = graph.display();
    }
}

Thanks for any help.

1

1 Answers

2
votes

Add a system property:

System.setProperty("org.graphstream.ui.renderer",
        "org.graphstream.ui.j2dviewer.J2DGraphRenderer");

Source