public static Graph clone(Graph g) {
Graph copy;
try {
Class<? extends Graph> cls = g.getClass();
copy = cls.getConstructor(String.class).newInstance(g.getId());
<BUG>} catch (Exception e) {
System.err.printf("*** WARNING *** can not create a graph of %s\n",
g.getClass().getName());</BUG>
copy = new AdjacencyListGraph(g.getId());
}

public static Graph clone(Graph g) {
Graph copy;
try {
Class<? extends Graph> cls = g.getClass();
copy = cls.getConstructor(String.class).newInstance(g.getId());
} catch (Exception e) {
logger.warning(String.format("Cannot create a graph of %s.", g.getClass().getName()));
copy = new AdjacencyListGraph(g.getId());
}
