在Graphstream中显示平行边 [英] Displaying Parallel Edges in Graphstream

查看:399
本文介绍了在Graphstream中显示平行边的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多图,我希望能够清楚地看到从一个顶点到另一个顶点的每条边。例如,当我有一个带有2个顶点的图形,以及从第一个到第二个的2个边缘时,我希望看到从第一个节点到第二个节点的2个箭头,而不是重叠的箭头。

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.

这是我目前的代码,您可以看到我正在尝试连接A和B的两条边:

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();
    }
}

感谢您的帮助。

推荐答案

添加系统属性:

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

来源

这篇关于在Graphstream中显示平行边的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆