Search in sources :

Example 1 with Ranks

use of com.baidu.hugegraph.structure.traverser.Ranks in project incubator-hugegraph-toolchain by apache.

the class NeighborRankApiTest method testNeighborRankWithIsolatedVertex.

@Test
public void testNeighborRankWithIsolatedVertex() {
    Vertex isolate = graph().addVertex(T.label, "person", T.id, "isolate", "name", "isolate-vertex");
    NeighborRankAPI.Request.Builder builder;
    builder = NeighborRankAPI.Request.builder();
    builder.source("isolate").alpha(0.9);
    builder.steps().direction(Direction.BOTH);
    NeighborRankAPI.Request request = builder.build();
    List<Ranks> ranks = neighborRankAPI.post(request);
    Assert.assertEquals(2, ranks.size());
    Assert.assertEquals(ImmutableMap.of("isolate", 1.0D), ranks.get(0));
    Assert.assertEquals(ImmutableMap.of(), ranks.get(1));
    graph().removeVertex(isolate.id());
}
Also used : Vertex(com.baidu.hugegraph.structure.graph.Vertex) Ranks(com.baidu.hugegraph.structure.traverser.Ranks) Test(org.junit.Test) BaseApiTest(com.baidu.hugegraph.api.BaseApiTest)

Aggregations

BaseApiTest (com.baidu.hugegraph.api.BaseApiTest)1 Vertex (com.baidu.hugegraph.structure.graph.Vertex)1 Ranks (com.baidu.hugegraph.structure.traverser.Ranks)1 Test (org.junit.Test)1