Displaying Parallel Edges in Graphstream

泪湿孤枕 提交于 2019-12-01 11:44:57

问题


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:


Add a system property:

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

Source



来源:https://stackoverflow.com/questions/23634855/displaying-parallel-edges-in-graphstream

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!