Interface ReachabilityAlgorithm<E>

Type Parameters:
E - the edge type
All Known Implementing Classes:
Dijkstra

public interface ReachabilityAlgorithm<E>
An algorithm which can determine which vertices on an explorable graph are reachable from a source.
Author:
Lee A. Christie
  • Method Summary

    Modifier and Type
    Method
    Description
    <V> Map<V,E>
    reachable(Explorable<V,E> graph, V source)
    Returns the set of reachable vertices and the corresponding cost of each vertex's shortest path.
    <V> Map<V,E>
    reachable(Explorable<V,E> graph, V source, E maxCost)
    Returns the set of vertices reachable within a given maximum cost, and the corresponding cost of each vertex's shortest path.
    <V> void
    reachable(Explorable<V,E> graph, V source, E maxCost, ReachabilityCallback<V,E> callback)
    Streams to a callback function the set of vertices reachable within a given maximum cost, and the corresponding cost of each vertex's shortest path.
    <V> void
    reachable(Explorable<V,E> graph, V source, ReachabilityCallback<V,E> callback)
    Streams to a callback function the set of reachable vertices and the corresponding cost of each vertex's shortest path.
  • Method Details

    • reachable

      <V> Map<V,E> reachable(Explorable<V,E> graph, V source) throws InterruptedException
      Returns the set of reachable vertices and the corresponding cost of each vertex's shortest path.
      Type Parameters:
      V - the vertex type
      Parameters:
      graph - the graph on which to route, not null
      source - , the source vertex, in graph, not null
      Returns:
      a map of reachable vertices, with associated costs
      Throws:
      InterruptedException - if the thread is interrupted, and the implementation supports interruption
    • reachable

      <V> Map<V,E> reachable(Explorable<V,E> graph, V source, E maxCost) throws InterruptedException
      Returns the set of vertices reachable within a given maximum cost, and the corresponding cost of each vertex's shortest path.
      Type Parameters:
      V - the vertex type
      Parameters:
      graph - the graph on which to route, not null
      source - , the source vertex, in graph, not null
      maxCost - , the maximum cost, considered unlimited if null
      Returns:
      a map of reachable vertices, with associated costs
      Throws:
      InterruptedException - if the thread is interrupted, and the implementation supports interruption
    • reachable

      <V> void reachable(Explorable<V,E> graph, V source, ReachabilityCallback<V,E> callback) throws InterruptedException
      Streams to a callback function the set of reachable vertices and the corresponding cost of each vertex's shortest path.
      Type Parameters:
      V - the vertex type
      Parameters:
      graph - the graph on which to route, not null
      source - the source vertex, in graph, not null
      callback - a callback which acts as a consumer of reachable vertices, with associated costs, but returns ReachabilityCallback.Action.BREAK if the algorithm should abandon the search or ReachabilityCallback.Action.CONTINUE otherwise, not null
      Throws:
      InterruptedException - if the thread is interrupted, and the implementation supports interruption
    • reachable

      <V> void reachable(Explorable<V,E> graph, V source, E maxCost, ReachabilityCallback<V,E> callback) throws InterruptedException
      Streams to a callback function the set of vertices reachable within a given maximum cost, and the corresponding cost of each vertex's shortest path.
      Type Parameters:
      V - the vertex type
      Parameters:
      graph - the graph on which to route, not null
      source - , the source vertex, in graph, not null
      maxCost - , the maximum cost, considered unlimited if null
      callback - a callback which acts as a consumer of reachable vertices, with associated costs, but returns ReachabilityCallback.Action.BREAK if the algorithm should abandon the search or ReachabilityCallback.Action.CONTINUE otherwise, not null
      Throws:
      InterruptedException - if the thread is interrupted, and the implementation supports interruption