我要在层次结构中显示类似树级的图形,因此我使用Jung中包含的TreeLayout(它是一般树)。我已将我的代码基于MinimumSpanningTreeDemo.java,并且对于简单的情况工作正常,但是当像图片更复杂时,我获得了类似于右侧的东西,而不是像左侧那样(我打算这样做)。
Problem 我使用它的布局如下:
Graph<String,String> graph,graphcopy;
Forest<String,String> tree;
Layout<String,String> layout;
AbstractLayout layout2;
MinimumSpanningForest2<String,String> prim =
new MinimumSpanningForest2<String,String>(graph,
new DelegateForest<String,String>(), DelegateTree.<String,String>getFactory(),
new ConstantTransformer(1.0));
tree = prim.getForest();
collapser = new GraphCollapser(graph);
layout = new TreeLayout<String,String>(tree,100,100);
layout2 = new StaticLayout<String,String>(graph, layout);
提前致谢!