use of com.baidu.hugegraph.structure.traverser.WeightedPath in project incubator-hugegraph-toolchain by apache.
the class WeightedShortestPathApiTest method testWeightedShortestPath.
@Test
public void testWeightedShortestPath() {
WeightedPath weightedPath = weightedShortestPathAPI.get("A", "Z", Direction.BOTH, null, "weight", -1, 0, -1, false);
Assert.assertTrue(weightedPath.vertices().isEmpty());
Assert.assertEquals(0.5D, weightedPath.path().weight(), Double.MIN_VALUE);
Assert.assertEquals(ImmutableList.of("A", "H", "I", "J", "Z"), weightedPath.path().vertices());
}
use of com.baidu.hugegraph.structure.traverser.WeightedPath in project incubator-hugegraph-toolchain by apache.
the class WeightedShortestPathApiTest method testWeightedShortestPathWithVertex.
@Test
public void testWeightedShortestPathWithVertex() {
WeightedPath weightedPath = weightedShortestPathAPI.get("A", "Z", Direction.BOTH, null, "weight", -1, 0, -1, true);
Assert.assertEquals(5, weightedPath.vertices().size());
List<Object> expected = ImmutableList.of("A", "H", "I", "J", "Z");
for (Vertex vertex : weightedPath.vertices()) {
Assert.assertTrue(expected.contains(vertex.id()));
}
}
use of com.baidu.hugegraph.structure.traverser.WeightedPath in project incubator-hugegraph-toolchain by apache.
the class WeightedShortestPathApiTest method testWeightedShortestPathWithLabel.
@Test
public void testWeightedShortestPathWithLabel() {
WeightedPath weightedPath = weightedShortestPathAPI.get("A", "Z", Direction.BOTH, "link", "weight", -1, 0, -1, false);
Assert.assertTrue(weightedPath.vertices().isEmpty());
Assert.assertEquals(0.5D, weightedPath.path().weight(), Double.MIN_VALUE);
Assert.assertEquals(ImmutableList.of("A", "H", "I", "J", "Z"), weightedPath.path().vertices());
weightedPath = weightedShortestPathAPI.get("A", "Z", Direction.BOTH, "relateTo", "weight", -1, 0, -1, false);
Assert.assertTrue(weightedPath.vertices().isEmpty());
Assert.assertEquals(6.3999999999999995D, weightedPath.path().weight(), Double.MIN_VALUE);
Assert.assertEquals(ImmutableList.of("A", "Q", "R", "Z"), weightedPath.path().vertices());
}
use of com.baidu.hugegraph.structure.traverser.WeightedPath in project incubator-hugegraph-toolchain by apache.
the class WeightedShortestPathApiTest method testWeightedShortestPathWithDegree.
@Test
public void testWeightedShortestPathWithDegree() {
WeightedPath weightedPath = weightedShortestPathAPI.get("A", "Z", Direction.OUT, null, "weight", 1L, 0L, -1L, false);
Assert.assertTrue(weightedPath.vertices().isEmpty());
Assert.assertEquals(2.0D, weightedPath.path().weight(), Double.MIN_VALUE);
Assert.assertEquals(ImmutableList.of("A", "B", "C", "D", "Z"), weightedPath.path().vertices());
}
use of com.baidu.hugegraph.structure.traverser.WeightedPath in project incubator-hugegraph-toolchain by apache.
the class WeightedShortestPathApiTest method testWeightedShortestPathWithDirection.
@Test
public void testWeightedShortestPathWithDirection() {
WeightedPath weightedPath = weightedShortestPathAPI.get("A", "Z", Direction.OUT, null, "weight", -1, 0, -1, false);
Assert.assertTrue(weightedPath.vertices().isEmpty());
Assert.assertEquals(2.0D, weightedPath.path().weight(), Double.MIN_VALUE);
Assert.assertEquals(ImmutableList.of("A", "B", "C", "D", "Z"), weightedPath.path().vertices());
}
Aggregations