org.neo4j.graphalgo.impl.path
Class ExactDepthPathFinder

java.lang.Object
  extended by org.neo4j.graphalgo.impl.path.ExactDepthPathFinder
All Implemented Interfaces:
PathFinder<Path>

public class ExactDepthPathFinder
extends Object
implements PathFinder<Path>

Tries to find paths in a graph from a start node to an end node where the length of found paths must be of a certain length. It also detects "super nodes", i.e. nodes which have many relationships and only iterates over such super nodes' relationships up to a supplied threshold. When that threshold is reached such nodes are considered super nodes and are put on a queue for later traversal. This makes it possible to find paths w/o having to traverse heavy super nodes.

Author:
Mattias Persson, Tobias Ivarsson

Constructor Summary
ExactDepthPathFinder(RelationshipExpander expander, int onDepth, int startThreshold)
           
 
Method Summary
 Iterable<Path> findAllPaths(Node start, Node end)
          Tries to find all paths between start and end nodes.
 Path findSinglePath(Node start, Node end)
          Tries to find a single path between start and end nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExactDepthPathFinder

public ExactDepthPathFinder(RelationshipExpander expander,
                            int onDepth,
                            int startThreshold)
Method Detail

findAllPaths

public Iterable<Path> findAllPaths(Node start,
                                   Node end)
Description copied from interface: PathFinder
Tries to find all paths between start and end nodes. A collection of Paths is returned with all the found paths. If no paths are found an empty collection is returned.

Specified by:
findAllPaths in interface PathFinder<Path>
Parameters:
start - the start Node which defines the start of the path.
end - the end Node which defines the end of the path.
Returns:
all Paths between start and end.

findSinglePath

public Path findSinglePath(Node start,
                           Node end)
Description copied from interface: PathFinder
Tries to find a single path between start and end nodes. If a path is found a Path is returned with that path information, else null is returned. If more than one path is found, the implementation can decide itself upon which of those to return.

Specified by:
findSinglePath in interface PathFinder<Path>
Parameters:
start - the start Node which defines the start of the path.
end - the end Node which defines the end of the path.
Returns:
a single Path between start and end, or null if no path was found.


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.