* This one only copies vertices which participate in transitions.
*/
@SuppressWarnings("unchecked")
public static DirectedSparseGraph copy(Graph g)
{
DirectedSparseGraph result = new DirectedSparseGraph();
Map<VertexID,DeterministicVertex> newVertices = new TreeMap<VertexID,DeterministicVertex>();
for(DirectedSparseEdge e:(Set<DirectedSparseEdge>)g.getEdges())
{
DeterministicVertex newSrc = DeterministicDirectedSparseGraph.copyVertex(newVertices,result,e.getSource()),
newDst = DeterministicDirectedSparseGraph.copyVertex(newVertices, result, e.getDest());
DirectedSparseEdge newEdge = new DirectedSparseEdge(newSrc,newDst);
newEdge.addUserDatum(JUConstants.LABEL, ((HashSet<String>)e.getUserDatum(JUConstants.LABEL)).clone(), UserData.SHARED);
result.addEdge(newEdge);
}
return result;
}