问题描述
我试图在JUNG图形包中对图形进行顶点切割。这可以通过以下图片来解释:
现在,我将从图中删除顶点c1:
正如您可以看到顶点c1已从图中移除,但顶点c2和c3也已移除
当我切割顶点c1时,我希望顶点c2和c3留在图中。
我使用
您可以看看 DelegateForest 及其命令可以指定是否删除整个子树植根于您的顶点
I am trying to do vertex cuts on graphs in the JUNG graph package. This is best explained by the following pictures:
Now, I am going to cut vertex "c1" out of the graph:
As you can see vertex "c1" has been removed from the graph, but so have the vertices "c2" and "c3"
I want the vertices "c2" and "c3" to stay in the graph when I cut vertex "c1".
I am using the removeVertex(V vertex) function to remove vertex "c1" from the graph.
- How can I implement my code to keep vertices "c2" and "c3" when I cut vertex "c1"?
- I am using a Forest as my graph type
You could take a look at DelegateForest and its removeVertex(vertex,boolean) command which lets you specify whether or not to remove the entire subtree rooted in your vertex
这篇关于Java Jung Vertex在图中切割的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!