1

当用户单击它时,我试图折叠顶点的所有子级。但问题是,每次我尝试这样做时,都会出现以下错误:

Tree must not contain edu.ics.jung.graph.DelegateForest@17510d96

代码如下:

public void graphClicked(MyNode v, MouseEvent me)
{
    Collection<MyNode> childrens = graph.getChildren(v);
    Collection picked = new Hashset(childrens);

    if(picked.size>1)
    {
        Graph ingraph = this.radialLayout.getGraph();

        Graph clusterGraph = collapser.getClusterGraph(graph,childrens);
        Graph g = collapser.collapse(ingraph,clustergraph); //The error report points on this line
        .
        .
        .
    }
}

我正在使用 Forestwith RadialLayout。谁能帮我?我该如何解决这个问题?

4

1 回答 1

1

在此处查看树节点折叠和顶点折叠演示:

http://jung.sourceforge.net/applet/index.html

这些中的每一个的源都包含在分发文件中。

于 2011-04-16T21:29:42.670 回答