Module org.jhotdraw8.graph
Package org.jhotdraw8.graph.path.algo
Class AnyIndexedVertexReachabilityAlgo<C extends Number & Comparable<C>>
java.lang.Object
org.jhotdraw8.graph.path.algo.AnyIndexedVertexReachabilityAlgo<C>
- Type Parameters:
C- the numeric type of cost values
- All Implemented Interfaces:
IndexedVertexReachabilityAlgo<C>
public class AnyIndexedVertexReachabilityAlgo<C extends Number & Comparable<C>>
extends Object
implements IndexedVertexReachabilityAlgo<C>
See
AnyArcPathSearchAlgo for a description of this
algorithm.
This implementation is optimized for IndexedDirectedGraph.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleantryToReach(@NonNull Iterable<Integer> startVertices, @NonNull IntPredicate goalPredicate, @NonNull Function<Integer, Spliterator.OfInt> nextVerticesFunction, int maxDepth, @NonNull C zero, @NonNull C costLimit, @NonNull BiFunction<Integer, Integer, C> costFunction, @NonNull BiFunction<C, C, C> sumFunction, @NonNull AddToIntSet visited) Search engine method.booleantryToReach(@NonNull Iterable<Integer> startVertices, @NonNull IntPredicate goalPredicate, @NonNull Function<Integer, Spliterator.OfInt> nextVerticesFunction, @NonNull AddToIntSet visited, @NonNull Integer maxDepth) Searches breadth-first whether a path from root to goal exists.
-
Constructor Details
-
AnyIndexedVertexReachabilityAlgo
public AnyIndexedVertexReachabilityAlgo()
-
-
Method Details
-
tryToReach
public boolean tryToReach(@NonNull Iterable<Integer> startVertices, @NonNull IntPredicate goalPredicate, @NonNull Function<Integer, Spliterator.OfInt> nextVerticesFunction, int maxDepth, @NonNull C zero, @NonNull C costLimit, @NonNull BiFunction<Integer, Integer, C> costFunction, @NonNull BiFunction<C, C, C> sumFunction, @NonNull AddToIntSet visited) Search engine method.- Specified by:
tryToReachin interfaceIndexedVertexReachabilityAlgo<C extends Number & Comparable<C>>- Parameters:
startVertices- the set of start verticesgoalPredicate- the goal predicatenextVerticesFunction- the next vertices functionmaxDepth- the maximal depth (inclusive) of the search Must be >= 0.zero- the zero cost valuecostLimit- the cost limit is ignoredcostFunction- the cost functionsumFunction- the sum function for adding two cost valuesvisited-- Returns:
-
tryToReach
public boolean tryToReach(@NonNull Iterable<Integer> startVertices, @NonNull IntPredicate goalPredicate, @NonNull Function<Integer, Spliterator.OfInt> nextVerticesFunction, @NonNull AddToIntSet visited, @NonNull Integer maxDepth) Searches breadth-first whether a path from root to goal exists.- Parameters:
startVertices- the starting points of the search Must be >= 0.goalPredicate- the goal of the search Must be >= 0.visited- a predicate with side effect. The predicate returns true if the specified vertex has been visited, and marks the specified vertex as visited.maxDepth- the maximal depth (inclusive) of the search.- Returns:
- true on success, false on failure
-