如何在JUNG 2.0框架中复制图表? [英] How to copy a graph in JUNG 2.0 framework?
本文介绍了如何在JUNG 2.0框架中复制图表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
非常感谢! 解决方案
p>下面用泛型代码,所以你应该用 String 来替换
。 V
和 E
code>图< String,String>
图< V,E> SRC;
图< V,E> DEST; (v v:src.getVertices())
dest.addVertex(v);
(e,src.getEdges())
dest.addEdge(e,src.getIncidentVertices(e));
in JUNG 1.7.6 there was the function copy() for this purpose (myGraph.copy()), but in JUNG 2.0 this function does not exist anymore. I could not find any other possibility to create a copy of a graph object. I would be very glad if someone could help me. A workaround would be nice, too.
Thanks a lot!
解决方案
Code below with generics, so you should replace V
and E
with String
for your Graph<String, String>
.
Graph<V, E> src;
Graph<V, E> dest;
for (V v : src.getVertices())
dest.addVertex(v);
for (E e : src.getEdges())
dest.addEdge(e, src.getIncidentVertices(e));
这篇关于如何在JUNG 2.0框架中复制图表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文