你必须TreeLayout在将Vertexes添加到图表后初始化,我尝试了它,它对我有用.
您必须执行以下操作:(请注意,这是一个1年前的代码,您可能会发现它有点过时了)
Layout<GraphVertex, GraphEdge> layout; //create a layout
layout = new TreeLayout<GraphVertex, GraphEdge>((Forest<GraphVertex, GraphEdge>) g);
// initialize your layout using the graph you created, which has to be of type forest
vv.setGraphLayout(layout);
// set the layout of the visualization viewer you are using to be the layout you just created (the tree layout)
Run Code Online (Sandbox Code Playgroud)
GraphVertex表示图中顶点的类是否表示图中GraphEdge的边.
| 归档时间: |
|
| 查看次数: |
4153 次 |
| 最近记录: |