) throws Exception
{
String VERTEX = "Vertex";
String EDGE = "Edge";
DirectedSparseGraph/*<DefaultRef, DefaultRef<Edge>>*/ newGraph = new DirectedSparseGraph<BoostRef, BoostRef<Edge, Object>>();
HashMap<Vertex, BoostRef<Vertex,?>> vertexMapping = new HashMap<Vertex, BoostRef<Vertex,?>>();
for (Vertex vertex : graph.getVertices())
{
BoostRef<Vertex,?> newVertex = new BoostRef<Vertex,Object>(vertex, VERTEX, true);
vertexMapping.put(vertex, newVertex);
newGraph.addVertex(newVertex);
}
for (Edge edge : graph.getEdges())
{
BoostRef<Edge,?> newVertex = new BoostRef<Edge,Object>(edge, EDGE, true);
newGraph.addVertex(newVertex);
newGraph.addEdge(new BoostRef<Edge, Object>(edge, EDGE, true), // use a new object with reference to the original edge
vertexMapping.get(graph.getSource(edge)), newVertex);
newGraph.addEdge(new BoostRef<Edge, Object>(edge, EDGE, true), // use a new object with reference to the original edge
newVertex, vertexMapping.get(graph.getDest(edge)));
}
Map<String, BoostFunction<? extends Object, Dimension,?>> typeDimensionGetter = new HashMap<String, BoostFunction<? extends Object, Dimension, ?>>();