Hi All,

is there a way to add a time limit to a shortestpath search?

*(it is for an embedded Java app running over 10Million Nodes; 100Million 
Relationships).(code snippet below).*

When  shortestpaths are found it executes very quickly (low 100s of mS). In 
the case when 0 paths are eventually found it takes many many minutes.

What I would like to do is terminate the search after say a second if 0 
paths have been found at that point. 

Any ideas?


Regards, John.


    static Iterator<Path> findShortestPathsJava(GraphDatabaseService db, 
Node sa, Node sb) {
    
        Iterable<Path> paths = null;
        try ( Transaction tx = db.beginTx(); ) {
        
            PathFinder<Path> finder = GraphAlgoFactory.shortestPath(
                PathExpanders.forTypeAndDirection( Rels.Link, 
Direction.OUTGOING ), 8 );
            paths = finder.findAllPaths( sa, sb );
            tx.success();
            tx.close();
        }
        catch (Exception e) {
            System.out.println("Exception on shortest Java Path Query: "  + 
e.getMessage());
            hasGraph = false;    
        }
      
        return paths.iterator();
        
    }

-- 
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