the title pretty much sums it all -
I'm using Jung as my graph model and I want to clone my graphs. is there a best-practice for this?
thanks
You could do a simple copy of vertices & edges:
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));
that would create a new Graph, but the objects inside will be passed by reference so you could use this cloning library https://code.google.com/p/cloning/
and do a deep copy:
Cloner cloner = new Cloner();
Graph<V, E> clonedGraph = cloner.deepClone(graph);