public static int getIdOf(Graph g, double latitude) {
   int s = g.getNodes();
   NodeAccess na = g.getNodeAccess();
   for (int i = 0; i < s; i++) {
     if (Math.abs(na.getLatitude(i) - latitude) < 1e-4) {
       return i;
     }
   }
   return -1;
 }
 protected void initExampleGraph(Graph g) {
   NodeAccess na = g.getNodeAccess();
   na.setNode(0, 12, 23);
   na.setNode(1, 38.33f, 135.3f);
   na.setNode(2, 6, 139);
   na.setNode(3, 78, 89);
   na.setNode(4, 2, 1);
   na.setNode(5, 7, 5);
   g.edge(0, 1, 12, true);
   g.edge(0, 2, 212, true);
   g.edge(0, 3, 212, true);
   g.edge(0, 4, 212, true);
   g.edge(0, 5, 212, true);
 }
 public boolean containsLatitude(Graph g, EdgeIterator iter, double latitude) {
   NodeAccess na = g.getNodeAccess();
   while (iter.next()) {
     if (Math.abs(na.getLatitude(iter.getAdjNode()) - latitude) < 1e-4) return true;
   }
   return false;
 }
  private void checkExampleGraph(Graph graph) {
    NodeAccess na = graph.getNodeAccess();
    assertEquals(12f, na.getLatitude(0), 1e-6);
    assertEquals(23f, na.getLongitude(0), 1e-6);

    assertEquals(38.33f, na.getLatitude(1), 1e-6);
    assertEquals(135.3f, na.getLongitude(1), 1e-6);

    assertEquals(6, na.getLatitude(2), 1e-6);
    assertEquals(139, na.getLongitude(2), 1e-6);

    assertEquals(78, na.getLatitude(3), 1e-6);
    assertEquals(89, na.getLongitude(3), 1e-6);

    assertEquals(GHUtility.asSet(0), GHUtility.getNeighbors(carOutExplorer.setBaseNode((1))));
    assertEquals(
        GHUtility.asSet(5, 4, 3, 2, 1), GHUtility.getNeighbors(carOutExplorer.setBaseNode(0)));
    try {
      assertEquals(0, count(carOutExplorer.setBaseNode(6)));
      // for now return empty iterator
      // assertFalse(true);
    } catch (Exception ex) {
    }
  }
  @Test
  public void testClone() {
    graph = createGraph();
    graph.edge(1, 2, 10, true);
    NodeAccess na = graph.getNodeAccess();
    na.setNode(0, 12, 23);
    na.setNode(1, 8, 13);
    na.setNode(2, 2, 10);
    na.setNode(3, 5, 9);
    graph.edge(1, 3, 10, true);

    Graph clone = graph.copyTo(createGraph(locationParent + "/clone", false));
    assertEquals(graph.getNodes(), clone.getNodes());
    assertEquals(
        count(carOutExplorer.setBaseNode(1)),
        count(clone.createEdgeExplorer(carOutFilter).setBaseNode(1)));
    clone.edge(1, 4, 10, true);
    assertEquals(3, count(clone.createEdgeExplorer(carOutFilter).setBaseNode(1)));
    assertEquals(graph.getBounds(), clone.getBounds());
    Helper.close((Closeable) clone);
  }