Graph 基于节点选择折叠jung节点

Graph 基于节点选择折叠jung节点,graph,collapse,jung,Graph,Collapse,Jung,我试图在用户单击顶点时折叠它的所有子对象。但问题是,每次我尝试这样做时,都会出现以下错误: Tree must not contain edu.ics.jung.graph.DelegateForest@17510d96 代码如下: public void graphClicked(MyNode v, MouseEvent me) { Collection<MyNode> childrens = graph.getChildren(v); Collection pi

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

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
        .
        .
        .
    }
}
public void graphlicked(MyNode v,MouseEvent me)
{
Collection childrens=graph.getchildrens(v);
选择的集合=新哈希集(子项);
如果(拾取。大小>1)
{
Graph ingraph=this.radialYout.getGraph();
Graph clusterGraph=collapser.getClusterGraph(Graph,childrens);
Graph g=collapser.collapse(ingraph,clustergraph);//错误报告指向此行
.
.
.
}
}
我正在使用一个
RadialLayout

有人能帮我吗?如何解决此问题?

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


分发文件中包含了每种方法的源代码。

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

分发文件中包含了其中每个文件的源