Node a = graph.getNode( "a" );
Node b = graph.getNode( "b" );
Node c = graph.getNode( "c" );
final Set<Node> allowedNodes = new HashSet<Node>( Arrays.asList( a, b, c ) );
PathFinder<Path> finder = new ShortestPath( 100, Traversal.expanderForAllTypes( Direction.OUTGOING ) )
{
@Override
protected Collection<Node> filterNextLevelNodes( Collection<Node> nextNodes )
{
for ( Node node : nextNodes )
{
if ( !allowedNodes.contains( node ) )
{
fail( "Node " + node.getProperty( KEY_ID ) + " shouldn't be expanded" );
}
}
return nextNodes;
}
};
finder.findAllPaths( a, c );
}