public void testEdgesOnWeight() throws Exception {
    Configuration config = IntervalFilterMap.createConfiguration(Edge.class, "weight", 0.3f, 0.45f);
    mapReduceDriver.withConfiguration(config);
    Map<Long, FaunusVertex> graph =
        runWithGraph(
            startPath(generateGraph(BaseTest.ExampleGraph.TINKERGRAPH, config), Edge.class),
            mapReduceDriver);
    assertEquals(graph.size(), 6);

    long counter = 0;
    for (FaunusVertex vertex : graph.values()) {
      for (Edge edge : vertex.getEdges(Direction.BOTH)) {
        if (((StandardFaunusEdge) edge).hasPaths()) {
          counter = ((StandardFaunusEdge) edge).pathCount() + counter;
          assertEquals(edge.getProperty("weight"), 0.4d);
        }
      }
    }
    assertEquals(counter, 4);

    assertEquals(
        DEFAULT_COMPAT.getCounter(mapReduceDriver, IntervalFilterMap.Counters.VERTICES_FILTERED),
        0);
    assertEquals(
        DEFAULT_COMPAT.getCounter(mapReduceDriver, IntervalFilterMap.Counters.EDGES_FILTERED), 8);

    identicalStructure(graph, ExampleGraph.TINKERGRAPH);
  }
  public void testVerticesWithPaths() throws Exception {
    Configuration config = new Configuration();
    config.setBoolean(Tokens.TITAN_HADOOP_PIPELINE_TRACK_PATHS, true);

    mapReduceDriver.withConfiguration(config);

    Map<Long, FaunusVertex> graph =
        runWithGraph(generateGraph(BaseTest.ExampleGraph.TINKERGRAPH, config), mapReduceDriver);

    assertEquals(graph.size(), 6);
    for (FaunusVertex vertex : graph.values()) {
      assertEquals(vertex.pathCount(), 1);
      assertEquals(vertex.getPaths().get(0).size(), 1);
      assertEquals(vertex.getPaths().get(0).get(0).getId(), vertex.getLongId());
      for (Edge edge : vertex.getEdges(Direction.BOTH)) {
        assertEquals(((StandardFaunusEdge) edge).pathCount(), 0);
      }
    }

    assertEquals(
        DEFAULT_COMPAT.getCounter(mapReduceDriver, VerticesMap.Counters.EDGES_PROCESSED), 12);
    assertEquals(
        DEFAULT_COMPAT.getCounter(mapReduceDriver, VerticesMap.Counters.VERTICES_PROCESSED), 6);

    identicalStructure(graph, ExampleGraph.TINKERGRAPH);
  }
  public void testVerticesWithNoPaths() throws Exception {
    Configuration config = new Configuration();
    mapReduceDriver.withConfiguration(config);

    Map<Long, FaunusVertex> graph =
        runWithGraph(generateGraph(BaseTest.ExampleGraph.TINKERGRAPH, config), mapReduceDriver);

    assertEquals(graph.size(), 6);
    for (FaunusVertex vertex : graph.values()) {
      assertEquals(vertex.pathCount(), 1);
      for (Edge edge : vertex.getEdges(Direction.BOTH)) {
        assertEquals(((StandardFaunusEdge) edge).pathCount(), 0);
      }

      try {
        vertex.getPaths();
        assertTrue(false);
      } catch (IllegalStateException e) {
        assertTrue(true);
      }
    }

    assertEquals(
        DEFAULT_COMPAT.getCounter(mapReduceDriver, VerticesMap.Counters.EDGES_PROCESSED), 12);
    assertEquals(
        DEFAULT_COMPAT.getCounter(mapReduceDriver, VerticesMap.Counters.VERTICES_PROCESSED), 6);

    identicalStructure(graph, ExampleGraph.TINKERGRAPH);
  }
  public void testVerticesOnAge() throws Exception {
    Configuration config = IntervalFilterMap.createConfiguration(Vertex.class, "age", 10, 30);
    mapReduceDriver.withConfiguration(config);

    Map<Long, FaunusVertex> graph =
        runWithGraph(
            startPath(generateGraph(BaseTest.ExampleGraph.TINKERGRAPH, config), Vertex.class),
            mapReduceDriver);
    assertEquals(graph.size(), 6);
    assertEquals(graph.get(1l).pathCount(), 1);
    assertEquals(graph.get(2l).pathCount(), 1);
    assertEquals(graph.get(3l).pathCount(), 0);
    assertEquals(graph.get(4l).pathCount(), 0);
    assertEquals(graph.get(5l).pathCount(), 0);
    assertEquals(graph.get(6l).pathCount(), 0);

    assertEquals(
        DEFAULT_COMPAT.getCounter(mapReduceDriver, IntervalFilterMap.Counters.VERTICES_FILTERED),
        4);
    assertEquals(
        DEFAULT_COMPAT.getCounter(mapReduceDriver, IntervalFilterMap.Counters.EDGES_FILTERED), 0);

    identicalStructure(graph, ExampleGraph.TINKERGRAPH);
  }