|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.neo4j.graphalgo.impl.path.ShortestPath
public class ShortestPath
Find (all or one) simple shortest path(s) between two nodes. It starts
from both ends and goes one relationship at the time, alternating side
between each traversal. It does so to minimize the traversal overhead
if one side has a very large amount of relationships, but the other one
very few. It performs well however the graph is proportioned.
Relationships are traversed in the specified directions from the start node,
but in the reverse direction ( Direction.reverse() ) from the
end node. This doesn't affect Direction.BOTH.
| Nested Class Summary | |
|---|---|
protected class |
ShortestPath.DirectionData
|
| Constructor Summary | |
|---|---|
ShortestPath(int maxDepth,
RelationshipExpander relExpander)
Constructs a new shortest path algorithm. |
|
ShortestPath(int maxDepth,
RelationshipExpander relExpander,
int maxResultCount)
Constructs a new shortest path algorithm. |
|
ShortestPath(int maxDepth,
RelationshipExpander relExpander,
int maxResultCount,
boolean findPathsOnMaxDepthOnly)
Constructs a new shortest path algorithm. |
|
| Method Summary | |
|---|---|
protected Collection<Node> |
filterNextLevelNodes(Collection<Node> nextNodes)
|
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 |
|---|
public ShortestPath(int maxDepth,
RelationshipExpander relExpander)
maxDepth - the maximum depth for the traversal. Returned paths
will never have a greater Path.length() than maxDepth.relExpander - the RelationshipExpander to use for deciding
which relationships to expand for each Node.
public ShortestPath(int maxDepth,
RelationshipExpander relExpander,
int maxResultCount)
maxDepth - the maximum depth for the traversal. Returned paths
will never have a greater Path.length() than maxDepth.relExpander - the RelationshipExpander to use for deciding
which relationships to expand for each Node.maxResultCount - the maximum number of hits to return. If this number
of hits are encountered the traversal will stop.
public ShortestPath(int maxDepth,
RelationshipExpander relExpander,
int maxResultCount,
boolean findPathsOnMaxDepthOnly)
maxDepth - the maximum depth for the traversal. Returned paths
will never have a greater Path.length() than maxDepth.relExpander - the RelationshipExpander to use for deciding
which relationships to expand for each Node.maxResultCount - the maximum number of hits to return. If this number
of hits are encountered the traversal will stop.findPathsOnMaxDepthOnly - if true then it will only try to
find paths on that particular depth (maxDepth).| Method Detail |
|---|
public Iterable<Path> findAllPaths(Node start,
Node end)
PathFinderstart and end nodes.
A collection of Paths is returned with all the found paths.
If no paths are found an empty collection is returned.
findAllPaths in interface PathFinder<Path>start - the start Node which defines the start of the path.end - the end Node which defines the end of the path.
Paths between start and end.
public Path findSinglePath(Node start,
Node end)
PathFinderstart 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.
findSinglePath in interface PathFinder<Path>start - the start Node which defines the start of the path.end - the end Node which defines the end of the path.
Path between start and end,
or null if no path was found.protected Collection<Node> filterNextLevelNodes(Collection<Node> nextNodes)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||