org.neo4j.graphalgo.impl.shortestpath
Interface SingleSourceShortestPath<CostType>

Type Parameters:
CostType - The datatype the edge weights are represented by.
All Known Implementing Classes:
SingleSourceShortestPathBFS, SingleSourceShortestPathDijkstra

public interface SingleSourceShortestPath<CostType>

An object implementing this encapsulates an algorithm able to solve the single source shortest path problem. I.e. it can find the shortest path(s) from a given start node to all other nodes in a network.

Author:
Patrik Larsson

Method Summary
 CostType getCost(Node targetNode)
          A call to this will run the algorithm, if not already done, and return the cost for the shortest paths between the start node and the target node.
 Direction getDirection()
          This can be used to retrieve the Direction in which relationships should be in the shortest path(s).
 List<PropertyContainer> getPath(Node targetNode)
          A call to this will run the algorithm to find a single shortest path, if not already done, and return it as an alternating list of Node/Relationship.
 List<Node> getPathAsNodes(Node targetNode)
          A call to this will run the algorithm, if not already done, and return the found path to the target node if found as a list of nodes.
 List<Relationship> getPathAsRelationships(Node targetNode)
          A call to this will run the algorithm to find a single shortest path, if not already done, and return it as a list of Relationships.
 List<List<PropertyContainer>> getPaths(Node targetNode)
          A call to this will run the algorithm to find all shortest paths, if not already done, and return them as alternating lists of Node/Relationship.
 List<List<Node>> getPathsAsNodes(Node targetNode)
          A call to this will run the algorithm to find all shortest paths, if not already done, and return them as lists of nodes.
 List<List<Relationship>> getPathsAsRelationships(Node targetNode)
          A call to this will run the algorithm to find all shortest paths, if not already done, and return them as lists of relationships.
 List<Node> getPredecessorNodes(Node node)
           
 Map<Node,List<Relationship>> getPredecessors()
          This can be used to retrieve the entire data structure representing the predecessors for every node.
 RelationshipType[] getRelationshipTypes()
          This can be used to retrieve the types of relationships that are traversed.
 void reset()
          This resets the calculation if we for some reason would like to redo it.
 void setStartNode(Node node)
          This sets the start node.
 

Method Detail

reset

void reset()
This resets the calculation if we for some reason would like to redo it.


setStartNode

void setStartNode(Node node)
This sets the start node. The found paths will start in this node.

Parameters:
node - The start node.

getPath

List<PropertyContainer> getPath(Node targetNode)
A call to this will run the algorithm to find a single shortest path, if not already done, and return it as an alternating list of Node/Relationship.

Returns:
The path as an alternating list of Node/Relationship.

getPathAsNodes

List<Node> getPathAsNodes(Node targetNode)
A call to this will run the algorithm, if not already done, and return the found path to the target node if found as a list of nodes.

Returns:
The path as a list of nodes.

getPathAsRelationships

List<Relationship> getPathAsRelationships(Node targetNode)
A call to this will run the algorithm to find a single shortest path, if not already done, and return it as a list of Relationships.

Returns:
The path as a list of Relationships.

getPaths

List<List<PropertyContainer>> getPaths(Node targetNode)
A call to this will run the algorithm to find all shortest paths, if not already done, and return them as alternating lists of Node/Relationship.

Returns:
A list of the paths as alternating lists of Node/Relationship.

getPathsAsNodes

List<List<Node>> getPathsAsNodes(Node targetNode)
A call to this will run the algorithm to find all shortest paths, if not already done, and return them as lists of nodes.

Returns:
A list of the paths as lists of nodes.

getPathsAsRelationships

List<List<Relationship>> getPathsAsRelationships(Node targetNode)
A call to this will run the algorithm to find all shortest paths, if not already done, and return them as lists of relationships.

Returns:
A list of the paths as lists of relationships.

getCost

CostType getCost(Node targetNode)
A call to this will run the algorithm, if not already done, and return the cost for the shortest paths between the start node and the target node.

Returns:
The total weight of the shortest path(s).

getPredecessorNodes

List<Node> getPredecessorNodes(Node node)
Parameters:
node -
Returns:
The nodes previous to the argument node in all found shortest paths or null if there are no such nodes.

getPredecessors

Map<Node,List<Relationship>> getPredecessors()
This can be used to retrieve the entire data structure representing the predecessors for every node.

Returns:

getDirection

Direction getDirection()
This can be used to retrieve the Direction in which relationships should be in the shortest path(s).

Returns:
The direction.

getRelationshipTypes

RelationshipType[] getRelationshipTypes()
This can be used to retrieve the types of relationships that are traversed.

Returns:
The relationship type(s).


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