JUNG - How to convert a DirectedGraph built from GraphML file to a Tree (Forest) type

StackOverflow https://stackoverflow.com/questions/18134373

  •  24-06-2022
  •  | 
  •  

문제

Right now I have a GraphML file that was built by writing out a JUNG DelegateTree graph using JUNG's GraphMLWriter. I'm trying to now read that file back into a new DelegateTree. When using GraphMLReader, you cannot read into a tree type (you get "use addChild() to add vertices" exceptions). So, I read the file into a DirectedGraph.

Now how do I convert that DirectedGraph into my desired DelegateTree type. I need it in this type for various reasons, mainly for display purposes. Thanks.

도움이 되었습니까?

해결책

DelegateTree has a constructor that allows you to specify the DirectedGraph to which it delegates: http://jung.sourceforge.net/doc/api/edu/uci/ics/jung/graph/DelegateTree.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top