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

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

public interface SingleSourceSingleSinkShortestPath<CostType>

An object implementing this encapsulates an algorithm able to solve the single source single sink shortest path problem. I.e. it can find the shortest path(s) between two given nodes in a network.

Author:
Patrik Larsson

Method Summary
 CostType getCost()
          A call to this will run the algorithm to find the cost for the shortest paths between the start node and the end node, if not calculated before.
 Direction getDirection()
          This can be used to retrieve the Direction in which relationships should be in the shortest path(s).
 List<PropertyContainer> getPath()
          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()
          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 nodes.
 List<Relationship> getPathAsRelationships()
          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()
          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()
          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()
          A call to this will run the algorithm to find all shortest paths, if not already done, and return them as lists of relationships.
 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 setEndNode(Node node)
          This sets the end node.
 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.

setEndNode

void setEndNode(Node node)
This sets the end node. The found paths will end in this node.

Parameters:
node - The end node.

getPath

List<PropertyContainer> getPath()
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()
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 nodes.

Returns:
The path as a list of nodes.

getPathAsRelationships

List<Relationship> getPathAsRelationships()
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()
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()
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()
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()
A call to this will run the algorithm to find the cost for the shortest paths between the start node and the end node, if not calculated before. This will usually find a single shortest path.

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

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.