I'm facing a similar situation. Did you eventually solve this?

On Sunday, June 26, 2016 at 12:55:29 AM UTC+3, rann wrote:
>
> Dear ,
>
> I am trying find the shortest path between two nodes .
>
> I am getting two shortest paths .But my requirement is internally it 
> should filter based on one of the nodes property value . it should return 
> relevant path based on node property value.
>
> I added Node  filter to the PathExpanderBuilder .but as it is traversing 
> through the whole path at some node, it is giving false as the getP1() 
> method is giving false and finally it is not returning any paths.
> can some body help?
>
> public Iterable<Path> shortestPath(Node sourceNode, Node destNode)
> {
> Integer depth=10;
>    PathExpander<?> expander;
>    List<Path> paths = new ArrayList<>();
>    if ( orderedRelTypes == null )
>    {
>        expander = PathExpanders.allTypesAndDirections();
>    }
>    else
>    {
>        PathExpanderBuilder expanderBuilder = PathExpanderBuilder.empty(); 
>        
> expanderBuilder = expanderBuilder
> .add(MyRelationshipTypes.IS_LOCATED_AT, Direction.BOTH)
> .add(MyRelationshipTypes.BELONGS_TO, Direction.BOTH)
> .add(MyRelationshipTypes.CARRIES, Direction.BOTH)
> .addNodeFilter(getP1());
>       
>        expander = expanderBuilder.build();
>    }
> try (Transaction tx = Neo4JDBEngine.getGraphService().beginTx()) {
> PathFinder<Path> shortestPath = GraphAlgoFactory.shortestPath(
> expander, depth == null ? 4 : depth.intValue());
> for (Path path : shortestPath.findAllPaths(sourceNode, destNode)) {
> paths.add(path);
> }
> tx.success();
> }
>    return paths;
> }
>
> public static Predicate<Node> getP1() {
> return p -> "RFS".equals(p.getProperty("Type"));
> }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to