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);
  }
예제 #2
0
 private static void debugEdge(final Edge e) {
   System.out.println("edge " + e + ":");
   for (String key : e.getPropertyKeys()) {
     System.out.println("\t" + key + ":\t'" + e.getProperty(key) + "'");
   }
   System.out.println("\t[in vertex]: " + e.getVertex(Direction.IN));
   System.out.println("\t[out vertex]: " + e.getVertex(Direction.OUT));
 }
예제 #3
0
 protected Map<Integer, ValueLoader> addEdgesLoaders() {
   Map<Integer, ValueLoader> returned = new TreeMap<Integer, ValueLoader>();
   for (Edge e : strategy.getOutEdgesFor(rootVertex, property)) {
     if (e.getProperty(Properties.collection_index.name()) != null) {
       returned.put(
           (Integer) e.getProperty(Properties.collection_index.name()),
           new LoadValueBehindEdge(e));
     } else {
       // These items are pushed to the latest element (after collectionSize) which has no value
       // set
       int index = Integer.MAX_VALUE - 1;
       while (returned.containsKey(index)) {
         index--;
       }
       returned.put(index, new LoadValueBehindEdge(e));
     }
   }
   return returned;
 }
  private void verifyLineageGraphForReplicationOrEviction(
      String feedName,
      String feedInstanceDataPath,
      WorkflowExecutionContext context,
      RelationshipLabel edgeLabel)
      throws Exception {
    String feedInstanceName =
        InstanceRelationshipGraphBuilder.getFeedInstanceName(
            feedName,
            context.getClusterName(),
            feedInstanceDataPath,
            context.getNominalTimeAsISO8601());
    Vertex feedVertex = getEntityVertex(feedInstanceName, RelationshipType.FEED_INSTANCE);

    Edge edge = feedVertex.getEdges(Direction.OUT, edgeLabel.getName()).iterator().next();
    Assert.assertNotNull(edge);
    Assert.assertEquals(
        edge.getProperty(RelationshipProperty.TIMESTAMP.getName()),
        context.getTimeStampAsISO8601());

    Vertex clusterVertex = edge.getVertex(Direction.IN);
    Assert.assertEquals(
        clusterVertex.getProperty(RelationshipProperty.NAME.getName()), context.getClusterName());
  }