@Test
 public void testFootMix() {
   graph = createGraph();
   graph.edge(0, 1).setDistance(10).setFlags(footEncoder.setProperties(10, true, true));
   graph.edge(0, 2).setDistance(10).setFlags(carEncoder.setProperties(10, true, true));
   graph
       .edge(0, 3)
       .setDistance(10)
       .setFlags(
           footEncoder.setProperties(10, true, true) | carEncoder.setProperties(10, true, true));
   EdgeExplorer footOutExplorer =
       graph.createEdgeExplorer(new DefaultEdgeFilter(footEncoder, false, true));
   assertEquals(GHUtility.asSet(3, 1), GHUtility.getNeighbors(footOutExplorer.setBaseNode(0)));
   assertEquals(GHUtility.asSet(3, 2), GHUtility.getNeighbors(carOutExplorer.setBaseNode(0)));
 }
  @Test
  public void testSimpleDelete2() {
    graph = createGraph();
    NodeAccess na = graph.getNodeAccess();
    assertEquals(-1, getIdOf(graph, 12));
    na.setNode(9, 9, 1);
    assertEquals(-1, getIdOf(graph, 12));

    na.setNode(11, 11, 1);
    na.setNode(12, 12, 1);

    // mini subnetwork which gets completely removed:
    graph.edge(5, 10, 510, true);
    graph.markNodeRemoved(5);
    graph.markNodeRemoved(10);

    PointList pl = new PointList();
    pl.add(1, 2, Double.NaN);
    pl.add(1, 3, Double.NaN);
    graph.edge(9, 11, 911, true).setWayGeometry(pl);
    graph.edge(9, 12, 912, true).setWayGeometry(pl);

    assertEquals(13, graph.getNodes());
    assertEquals(Arrays.<String>asList(), GHUtility.getProblems(graph));

    // perform deletion
    graph.optimize();

    assertEquals(11, graph.getNodes());
    assertEquals(Arrays.<String>asList(), GHUtility.getProblems(graph));

    int id11 = getIdOf(graph, 11); // is now 10
    int id12 = getIdOf(graph, 12); // is now 5
    int id9 = getIdOf(graph, 9); // is now 9
    assertEquals(
        GHUtility.asSet(id12, id11), GHUtility.getNeighbors(carAllExplorer.setBaseNode(id9)));
    assertEquals(GHUtility.asSet(id9), GHUtility.getNeighbors(carAllExplorer.setBaseNode(id11)));
    assertEquals(GHUtility.asSet(id9), GHUtility.getNeighbors(carAllExplorer.setBaseNode(id12)));

    EdgeIterator iter = carAllExplorer.setBaseNode(id9);
    assertTrue(iter.next());
    assertEquals(id12, iter.getAdjNode());
    assertEquals(2, iter.fetchWayGeometry(0).getLongitude(0), 1e-7);

    assertTrue(iter.next());
    assertEquals(id11, iter.getAdjNode());
    assertEquals(2, iter.fetchWayGeometry(0).getLongitude(0), 1e-7);
  }
  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) {
    }
  }