### Question:
GHUtility { public static Graph copyTo( Graph fromGraph, Graph toGraph ) { AllEdgesIterator eIter = fromGraph.getAllEdges(); while (eIter.next()) { int base = eIter.getBaseNode(); int adj = eIter.getAdjNode(); eIter.copyPropertiesTo(toGraph.edge(base, adj)); } NodeAccess fna = fromGraph.getNodeAccess(); NodeAccess tna = toGraph.getNodeAccess(); int nodes = fromGraph.getNodes(); for (int node = 0; node < nodes; node++) { if (tna.is3D()) tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node), fna.getElevation(node)); else tna.setNode(node, fna.getLatitude(node), fna.getLongitude(node)); } return toGraph; }  static List<String> getProblems( Graph g ); static int count( EdgeIterator iter ); static Set<Integer> asSet( int... values ); static Set<Integer> getNeighbors( EdgeIterator iter ); static List<Integer> getEdgeIds( EdgeIterator iter ); static void printEdgeInfo( final Graph g, FlagEncoder encoder ); static void printInfo( final Graph g, int startNode, final int counts, final EdgeFilter filter ); static String getNodeInfo( CHGraph g, int nodeId, EdgeFilter filter ); static String getNodeInfo( Graph g, int nodeId, EdgeFilter filter ); static Graph shuffle( Graph g, Graph sortedGraph ); static Graph sortDFS( Graph g, Graph sortedGraph ); static Graph copyTo( Graph fromGraph, Graph toGraph ); static GraphHopperStorage newStorage( GraphHopperStorage store ); static int getAdjNode( Graph g, int edge, int adjNode ); static EdgeIteratorState getEdge( Graph graph, int base, int adj ); static int createEdgeKey( int nodeA, int nodeB, int edgeId, boolean reverse ); static boolean isSameEdgeKeys( int edgeKey1, int edgeKey2 ); static int reverseEdgeKey( int edgeKey );  }### Answer:
@Test public void testCopyWithSelfRef() { Graph g = initUnsorted(createGraph()); EdgeIteratorState eb = g.edge(0, 0, 11, true); CHGraph lg = new GraphBuilder(encodingManager).chGraphCreate(new FastestWeighting(carEncoder)); GHUtility.copyTo(g, lg); assertEquals(g.getAllEdges().getMaxId(), lg.getAllEdges().getMaxId()); }