use of org.neo4j.graphalgo.impl.path.ExactDepthPathFinder in project neo4j by neo4j.
the class TestExactDepthPathFinder method shouldHandleNeighbouringNodesWhenNotAlone.
@Test
public void shouldHandleNeighbouringNodesWhenNotAlone() {
// (a) - (b)
// |
// (c)
graph.makeEdge("a", "b");
graph.makeEdge("a", "c");
Node a = graph.getNode("a");
Node b = graph.getNode("b");
ExactDepthPathFinder pathFinder = new ExactDepthPathFinder(PathExpanders.allTypesAndDirections(), 1, Integer.MAX_VALUE, false);
Iterable<Path> allPaths = pathFinder.findAllPaths(a, b);
assertPaths(new ExactDepthPathFinder(PathExpanders.allTypesAndDirections(), 1, Integer.MAX_VALUE, false).findAllPaths(a, b), "a,b");
assertPaths(new ExactDepthPathFinder(PathExpanders.allTypesAndDirections(), 1, Integer.MAX_VALUE, false).findAllPaths(a, b), "a,b");
}
use of org.neo4j.graphalgo.impl.path.ExactDepthPathFinder in project neo4j by neo4j.
the class TestExactDepthPathFinder method shouldHandleSimpleChainOddDepth.
@Test
public void shouldHandleSimpleChainOddDepth() {
// (a) - (b) - (c) - (d)
graph.makeEdgeChain("a,b,c,d");
Node a = graph.getNode("a");
Node d = graph.getNode("d");
assertPaths(new ExactDepthPathFinder(PathExpanders.allTypesAndDirections(), 3, Integer.MAX_VALUE, false).findAllPaths(a, d), "a,b,c,d");
assertPaths(new ExactDepthPathFinder(PathExpanders.allTypesAndDirections(), 3, Integer.MAX_VALUE, false).findAllPaths(a, d), "a,b,c,d");
}
use of org.neo4j.graphalgo.impl.path.ExactDepthPathFinder in project neo4j by neo4j.
the class TestExactDepthPathFinder method testExactDepthPathsLoopsAllowed.
@Test
public void testExactDepthPathsLoopsAllowed() {
// Layout:
//
// (a)-->(b)==>(c)-->(e)
// ^ /
// \ v
// (d)
//
graph.makeEdgeChain("a,b,c,d,b,c,e");
Node a = graph.getNode("a");
Node e = graph.getNode("e");
assertPaths(new ExactDepthPathFinder(PathExpanders.forDirection(Direction.OUTGOING), 6, Integer.MAX_VALUE, true).findAllPaths(a, e), "a,b,c,d,b,c,e");
}
Aggregations