Java Jung Vertex Cuts in Graphs

一个人想着一个人 提交于 2019-12-12 05:25:10

问题


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.

  1. How can I implement my code to keep vertices "c2" and "c3" when I cut vertex "c1"?
  2. I am using a Forest as my graph type

回答1:


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



来源:https://stackoverflow.com/questions/12966684/java-jung-vertex-cuts-in-graphs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!