我正在使用JUNG来构建图形,但我无法在图形中添加额外的边缘。如何在Forest类中为我的图形添加额外的边? 这是我的代码
public class BalloonLayoutDemo {
// Code borrowed from JUNG's demos
Factory<String> edgeFactory = new Factory<String>() {
int i = 1;
public String create() {
System.out.println(i);
return Integer.toString(i++);
}
};
Forest<String, String> createTree(Forest<String, String> graph) {
String base = "Base Node";
graph.addEdge(edgeFactory.create(), base, "B0");
graph.addEdge(edgeFactory.create(), base, "B1");
graph.addEdge(edgeFactory.create(), base, "B2");
graph.addEdge(edgeFactory.create(), base, "C1");
graph.addEdge(edgeFactory.create(), base, "C1");
graph.addEdge(edgeFactory.create(), base, "C1");
return graph;
}
}