GraphAlgoFactory (Neo4j Community 2.1.0-M01 API)
Date: 2014-02-20

org.neo4j.graphalgo

## Class GraphAlgoFactory

- java.lang.Object
- - org.neo4j.graphalgo.GraphAlgoFactory

-     public abstract class GraphAlgoFactory
      extends Object

  Static factory methods for the recommended implementations of common graph algorithms for Neo4j. The algorithms exposed here are implementations which are tested extensively and also scale on bigger graphs.
  Author:
    Mattias Persson

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GraphAlgoFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PathFinder<Path>` | `allPaths(PathExpander expander, int maxDepth)` Returns an algorithm which can find all available paths between two nodes.
    `static PathFinder<Path>` | `allPaths(RelationshipExpander expander, int maxDepth)` Returns an algorithm which can find all available paths between two nodes.
    `static PathFinder<Path>` | `allSimplePaths(PathExpander expander, int maxDepth)` Returns an algorithm which can find all simple paths between two nodes.
    `static PathFinder<Path>` | `allSimplePaths(RelationshipExpander expander, int maxDepth)` Returns an algorithm which can find all simple paths between two nodes.
    `static PathFinder<WeightedPath>` | `aStar(PathExpander expander, CostEvaluator<Double> lengthEvaluator, EstimateEvaluator<Double> estimateEvaluator)` Returns an `PathFinder` which uses the A* algorithm to find the cheapest path between two nodes.
    `static PathFinder<WeightedPath>` | `aStar(RelationshipExpander expander, CostEvaluator<Double> lengthEvaluator, EstimateEvaluator<Double> estimateEvaluator)` Returns an `PathFinder` which uses the A* algorithm to find the cheapest path between two nodes.
    `static PathFinder<WeightedPath>` | `dijkstra(PathExpander expander, CostEvaluator<Double> costEvaluator)` Returns an `PathFinder` which uses the Dijkstra algorithm to find the cheapest path between two nodes.
    `static PathFinder<WeightedPath>` | `dijkstra(PathExpander expander, InitialBranchState stateFactory, CostEvaluator<Double> costEvaluator)` See `dijkstra(RelationshipExpander, CostEvaluator)`.
    `static PathFinder<WeightedPath>` | `dijkstra(PathExpander expander, InitialBranchState stateFactory, String relationshipPropertyRepresentingCost)` See `dijkstra(RelationshipExpander, CostEvaluator)`.
    `static PathFinder<WeightedPath>` | `dijkstra(PathExpander expander, InitialStateFactory stateFactory, CostEvaluator<Double> costEvaluator)` See `dijkstra(RelationshipExpander, CostEvaluator)`.
    `static PathFinder<WeightedPath>` | `dijkstra(PathExpander expander, InitialStateFactory stateFactory, String relationshipPropertyRepresentingCost)` See `dijkstra(RelationshipExpander, CostEvaluator)`.
    `static PathFinder<WeightedPath>` | `dijkstra(PathExpander expander, String relationshipPropertyRepresentingCost)` See `dijkstra(RelationshipExpander, CostEvaluator)`.
    `static PathFinder<WeightedPath>` | `dijkstra(RelationshipExpander expander, CostEvaluator<Double> costEvaluator)` Returns an `PathFinder` which uses the Dijkstra algorithm to find the cheapest path between two nodes.
    `static PathFinder<WeightedPath>` | `dijkstra(RelationshipExpander expander, String relationshipPropertyRepresentingCost)` See `dijkstra(RelationshipExpander, CostEvaluator)`.
    `static PathFinder<Path>` | `pathsWithLength(PathExpander expander, int length)` Returns an algorithm which can find simple all paths of a certain length between two nodes.
    `static PathFinder<Path>` | `pathsWithLength(RelationshipExpander expander, int length)` Returns an algorithm which can find simple all paths of a certain length between two nodes.
    `static PathFinder<Path>` | `shortestPath(PathExpander expander, int maxDepth)` Returns an algorithm which can find all shortest paths (that is paths with as short `Path.length()` as possible) between two nodes.
    `static PathFinder<Path>` | `shortestPath(PathExpander expander, int maxDepth, int maxHitCount)` Returns an algorithm which can find all shortest paths (that is paths with as short `Path.length()` as possible) between two nodes.
    `static PathFinder<Path>` | `shortestPath(RelationshipExpander expander, int maxDepth)` Returns an algorithm which can find all shortest paths (that is paths with as short `Path.length()` as possible) between two nodes.
    `static PathFinder<Path>` | `shortestPath(RelationshipExpander expander, int maxDepth, int maxHitCount)` Returns an algorithm which can find all shortest paths (that is paths with as short `Path.length()` as possible) between two nodes.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GraphAlgoFactory

          public GraphAlgoFactory()

  - ### Method Detail

    - #### allPaths

          public static PathFinder<Path> allPaths(RelationshipExpander expander,
                                  int maxDepth)

      Returns an algorithm which can find all available paths between two nodes. These returned paths can contain loops (i.e. a node can occur more than once in any returned path).
      Parameters:
        `expander` - the `RelationshipExpander` to use for expanding `Relationship`s for each `Node`.
        `maxDepth` - the max `Path.length()` returned paths are allowed to have.
      Returns:
        an algorithm which finds all paths between two nodes.
      See Also:
        `AllPaths`

    - #### allPaths

          public static PathFinder<Path> allPaths(PathExpander expander,
                                  int maxDepth)

      Returns an algorithm which can find all available paths between two nodes. These returned paths can contain loops (i.e. a node can occur more than once in any returned path).
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Path`.
        `maxDepth` - the max `Path.length()` returned paths are allowed to have.
      Returns:
        an algorithm which finds all paths between two nodes.
      See Also:
        `AllPaths`

    - #### allSimplePaths

          public static PathFinder<Path> allSimplePaths(RelationshipExpander expander,
                                        int maxDepth)

      Returns an algorithm which can find all simple paths between two nodes. These returned paths cannot contain loops (i.e. a node cannot occur more than once in any returned path).
      Parameters:
        `expander` - the `RelationshipExpander` to use for expanding `Relationship`s for each `Node`.
        `maxDepth` - the max `Path.length()` returned paths are allowed to have.
      Returns:
        an algorithm which finds simple paths between two nodes.
      See Also:
        `AllSimplePaths`

    - #### allSimplePaths

          public static PathFinder<Path> allSimplePaths(PathExpander expander,
                                        int maxDepth)

      Returns an algorithm which can find all simple paths between two nodes. These returned paths cannot contain loops (i.e. a node cannot occur more than once in any returned path).
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Path`.
        `maxDepth` - the max `Path.length()` returned paths are allowed to have.
      Returns:
        an algorithm which finds simple paths between two nodes.
      See Also:
        `AllSimplePaths`

    - #### shortestPath

          public static PathFinder<Path> shortestPath(RelationshipExpander expander,
                                      int maxDepth)

      Returns an algorithm which can find all shortest paths (that is paths with as short `Path.length()` as possible) between two nodes. These returned paths cannot contain loops (i.e. a node cannot occur more than once in any returned path).
      Parameters:
        `expander` - the `RelationshipExpander` to use for expanding `Relationship`s for each `Node`.
        `maxDepth` - the max `Path.length()` returned paths are allowed to have.
      Returns:
        an algorithm which finds shortest paths between two nodes.
      See Also:
        `ShortestPath`

    - #### shortestPath

          public static PathFinder<Path> shortestPath(PathExpander expander,
                                      int maxDepth)

      Returns an algorithm which can find all shortest paths (that is paths with as short `Path.length()` as possible) between two nodes. These returned paths cannot contain loops (i.e. a node cannot occur more than once in any returned path).
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Path`.
        `maxDepth` - the max `Path.length()` returned paths are allowed to have.
      Returns:
        an algorithm which finds shortest paths between two nodes.
      See Also:
        `ShortestPath`

    - #### shortestPath

          public static PathFinder<Path> shortestPath(RelationshipExpander expander,
                                      int maxDepth,
                                      int maxHitCount)

      Returns an algorithm which can find all shortest paths (that is paths with as short `Path.length()` as possible) between two nodes. These returned paths cannot contain loops (i.e. a node cannot occur more than once in any returned path).
      Parameters:
        `expander` - the `RelationshipExpander` to use for expanding `Relationship`s for each `Node`.
        `maxDepth` - the max `Path.length()` returned paths are allowed to have.
        `maxHitCount` - the maximum number of `Path`s to return. If this number of found paths are encountered the traversal will stop.
      Returns:
        an algorithm which finds shortest paths between two nodes.
      See Also:
        `ShortestPath`

    - #### shortestPath

          public static PathFinder<Path> shortestPath(PathExpander expander,
                                      int maxDepth,
                                      int maxHitCount)

      Returns an algorithm which can find all shortest paths (that is paths with as short `Path.length()` as possible) between two nodes. These returned paths cannot contain loops (i.e. a node cannot occur more than once in any returned path).
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Path`.
        `maxDepth` - the max `Path.length()` returned paths are allowed to have.
        `maxHitCount` - the maximum number of `Path`s to return. If this number of found paths are encountered the traversal will stop.
      Returns:
        an algorithm which finds shortest paths between two nodes.
      See Also:
        `ShortestPath`

    - #### pathsWithLength

          public static PathFinder<Path> pathsWithLength(RelationshipExpander expander,
                                         int length)

      Returns an algorithm which can find simple all paths of a certain length between two nodes. These returned paths cannot contain loops (i.e. a node could not occur more than once in any returned path).
      Parameters:
        `expander` - the `RelationshipExpander` to use for expanding `Relationship`s for each `Node`.
        `length` - the `Path.length()` returned paths will have, if any paths were found.
      Returns:
        an algorithm which finds paths of a certain length between two nodes.
      See Also:
        `ShortestPath`

    - #### pathsWithLength

          public static PathFinder<Path> pathsWithLength(PathExpander expander,
                                         int length)

      Returns an algorithm which can find simple all paths of a certain length between two nodes. These returned paths cannot contain loops (i.e. a node could not occur more than once in any returned path).
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Node`.
        `length` - the `Path.length()` returned paths will have, if any paths were found.
      Returns:
        an algorithm which finds paths of a certain length between two nodes.
      See Also:
        `ShortestPath`

    - #### aStar

          public static PathFinder<WeightedPath> aStar(RelationshipExpander expander,
                                       CostEvaluator<Double> lengthEvaluator,
                                       EstimateEvaluator<Double> estimateEvaluator)

      Returns an `PathFinder` which uses the A* algorithm to find the cheapest path between two nodes. The definition of "cheap" is the lowest possible cost to get from the start node to the end node, where the cost is returned from `lengthEvaluator` and `estimateEvaluator`. These returned paths cannot contain loops (i.e. a node cannot occur more than once in any returned path). See http://en.wikipedia.org/wiki/A*_search_algorithm for more information.
      Parameters:
        `expander` - the `RelationshipExpander` to use for expanding `Relationship`s for each `Node`.
        `lengthEvaluator` - evaluator that can return the cost represented by each relationship the algorithm traverses.
        `estimateEvaluator` - evaluator that returns an (optimistic) estimation of the cost to get from the current node (in the traversal) to the end node.
      Returns:
        an algorithm which finds the cheapest path between two nodes using the A* algorithm.
      See Also:
        `AStar`

    - #### aStar

          public static PathFinder<WeightedPath> aStar(PathExpander expander,
                                       CostEvaluator<Double> lengthEvaluator,
                                       EstimateEvaluator<Double> estimateEvaluator)

      Returns an `PathFinder` which uses the A* algorithm to find the cheapest path between two nodes. The definition of "cheap" is the lowest possible cost to get from the start node to the end node, where the cost is returned from `lengthEvaluator` and `estimateEvaluator`. These returned paths cannot contain loops (i.e. a node cannot occur more than once in any returned path). See http://en.wikipedia.org/wiki/A*_search_algorithm for more information.
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Path`.
        `lengthEvaluator` - evaluator that can return the cost represented by each relationship the algorithm traverses.
        `estimateEvaluator` - evaluator that returns an (optimistic) estimation of the cost to get from the current node (in the traversal) to the end node.
      Returns:
        an algorithm which finds the cheapest path between two nodes using the A* algorithm.
      See Also:
        `AStar`

    - #### dijkstra

          public static PathFinder<WeightedPath> dijkstra(RelationshipExpander expander,
                                          CostEvaluator<Double> costEvaluator)

      Returns an `PathFinder` which uses the Dijkstra algorithm to find the cheapest path between two nodes. The definition of "cheap" is the lowest possible cost to get from the start node to the end node, where the cost is returned from `costEvaluator`. These returned paths cannot contain loops (i.e. a node cannot occur more than once in any returned path). See http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm for more information.
      Parameters:
        `expander` - the `RelationshipExpander` to use for expanding `Relationship`s for each `Node`.
        `costEvaluator` - evaluator that can return the cost represented by each relationship the algorithm traverses.
      Returns:
        an algorithm which finds the cheapest path between two nodes using the Dijkstra algorithm.
      See Also:
        `Dijkstra`

    - #### dijkstra

          public static PathFinder<WeightedPath> dijkstra(PathExpander expander,
                                          CostEvaluator<Double> costEvaluator)

      Returns an `PathFinder` which uses the Dijkstra algorithm to find the cheapest path between two nodes. The definition of "cheap" is the lowest possible cost to get from the start node to the end node, where the cost is returned from `costEvaluator`. These returned paths cannot contain loops (i.e. a node cannot occur more than once in any returned path). See http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm for more information.
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Path`.
        `costEvaluator` - evaluator that can return the cost represented by each relationship the algorithm traverses.
      Returns:
        an algorithm which finds the cheapest path between two nodes using the Dijkstra algorithm.
      See Also:
        `Dijkstra`

    - #### dijkstra

          public static PathFinder<WeightedPath> dijkstra(RelationshipExpander expander,
                                          String relationshipPropertyRepresentingCost)

      See `dijkstra(RelationshipExpander, CostEvaluator)`. Uses a cost evaluator which uses the supplied property key to represent the cost (values of type double).
      Parameters:
        `expander` - the `RelationshipExpander` to use for expanding `Relationship`s for each `Node`.
        `relationshipPropertyRepresentingCost` - the property to represent cost on each relationship the algorithm traverses.
      Returns:
        an algorithm which finds the cheapest path between two nodes using the Dijkstra algorithm.

    - #### dijkstra

          public static PathFinder<WeightedPath> dijkstra(PathExpander expander,
                                          String relationshipPropertyRepresentingCost)

      See `dijkstra(RelationshipExpander, CostEvaluator)`. Uses a cost evaluator which uses the supplied property key to represent the cost (values of type double).
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Path`.
        `relationshipPropertyRepresentingCost` - the property to represent cost on each relationship the algorithm traverses.
      Returns:
        an algorithm which finds the cheapest path between two nodes using the Dijkstra algorithm.

    - #### dijkstra

          public static PathFinder<WeightedPath> dijkstra(PathExpander expander,
                                          InitialStateFactory stateFactory,
                                          CostEvaluator<Double> costEvaluator)

      See `dijkstra(RelationshipExpander, CostEvaluator)`. Uses a cost evaluator which uses the supplied property key to represent the cost (values of type double).
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Path`.
        `stateFactory` - initial state for the traversal branches.
        `costEvaluator` - the cost evaluator for each relationship the algorithm traverses.
      Returns:
        an algorithm which finds the cheapest path between two nodes using the Dijkstra algorithm.

    - #### dijkstra

          public static PathFinder<WeightedPath> dijkstra(PathExpander expander,
                                          InitialBranchState stateFactory,
                                          CostEvaluator<Double> costEvaluator)

      See `dijkstra(RelationshipExpander, CostEvaluator)`. Uses a cost evaluator which uses the supplied property key to represent the cost (values of type double).
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Path`.
        `stateFactory` - initial state for the traversal branches.
        `costEvaluator` - the cost evaluator for each relationship the algorithm traverses.
      Returns:
        an algorithm which finds the cheapest path between two nodes using the Dijkstra algorithm.

    - #### dijkstra

          public static PathFinder<WeightedPath> dijkstra(PathExpander expander,
                                          InitialStateFactory stateFactory,
                                          String relationshipPropertyRepresentingCost)

      See `dijkstra(RelationshipExpander, CostEvaluator)`. Uses a cost evaluator which uses the supplied property key to represent the cost (values of type double).
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Path`.
        `stateFactory` - initial state for the traversal branches.
        `relationshipPropertyRepresentingCost` - the property to represent cost on each relationship the algorithm traverses.
      Returns:
        an algorithm which finds the cheapest path between two nodes using the Dijkstra algorithm.

    - #### dijkstra

          public static PathFinder<WeightedPath> dijkstra(PathExpander expander,
                                          InitialBranchState stateFactory,
                                          String relationshipPropertyRepresentingCost)

      See `dijkstra(RelationshipExpander, CostEvaluator)`. Uses a cost evaluator which uses the supplied property key to represent the cost (values of type double).
      Parameters:
        `expander` - the `PathExpander` to use for expanding `Relationship`s for each `Path`.
        `stateFactory` - initial state for the traversal branches.
        `relationshipPropertyRepresentingCost` - the property to represent cost on each relationship the algorithm traverses.
      Returns:
        an algorithm which finds the cheapest path between two nodes using the Dijkstra algorithm.

Copyright © 2002–2014 The Neo4j Graph Database Project. All rights reserved.