org.eclipse.incquery.runtime.base.itc.igraph

## Interface ITcDataSource<V>

- Type Parameters:
    `V` - the type parameter of the node
  All Known Subinterfaces:
    TransitiveClosureHelper
  All Known Implementing Classes:
    CountingAlg, DRedAlg, IncSCCAlg, TransitiveClosureHelperImpl

      public interface ITcDataSource<V>

  This interface defines those methods that a transitive reachability data source should provide.
  Author:
    Tamas Szabo

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `attachObserver(ITcObserver<V> to)` Attach a transitive closure relation observer.
    `void` | `detachObserver(ITcObserver<V> to)` Detach a transitive closure relation observer.
    `void` | `dispose()` Call this method to properly dispose the data structures of a transitive closure algorithm.
    `java.util.Set<V>` | `getAllReachableSources(V target)` Returns all nodes from which the target node is reachable.
    `java.util.Set<V>` | `getAllReachableTargets(V source)` Returns all nodes which are reachable from the source node.
    `IGraphPathFinder<V>` | `getPathFinder()` The returned `IGraphPathFinder` can be used to retrieve paths between nodes using transitive reachability.
    `java.util.List<V>` | `getReachabilityPath(V source, V target)` Deprecated. Use `getPathFinder()` instead
    `boolean` | `isReachable(V source, V target)` Returns true if the target node is reachable from the source node.

- - ### Method Detail

    - #### attachObserver

          void attachObserver(ITcObserver<V> to)

      Attach a transitive closure relation observer.
      Parameters:
        `to` - the observer object

    - #### detachObserver

          void detachObserver(ITcObserver<V> to)

      Detach a transitive closure relation observer.
      Parameters:
        `to` - the observer object

    - #### getAllReachableTargets

          java.util.Set<V> getAllReachableTargets(V source)

      Returns all nodes which are reachable from the source node.
      Parameters:
        `source` - the source node
      Returns:
        the set of target nodes

    - #### getAllReachableSources

          java.util.Set<V> getAllReachableSources(V target)

      Returns all nodes from which the target node is reachable.
      Parameters:
        `target` - the target node
      Returns:
        the set of source nodes

    - #### isReachable

          boolean isReachable(V source,
                              V target)

      Returns true if the target node is reachable from the source node.
      Parameters:
        `source` - the source node
        `target` - the target node
      Returns:
        true if target is reachable from source, false otherwise

    - #### getReachabilityPath

          @Deprecated
          java.util.List<V> getReachabilityPath(V source,
                                                            V target)

      Deprecated. Use `getPathFinder()` instead
      Returns a reachability path between the given source and target elements, or null if no such transitive reachability is present in the graph. The returned `List` contains the nodes along the path (this means that there is an edge in the graph between two consecutive nodes), including the source and target nodes. A self loop (one edge) is indicated with the source node being present two times in the returned `List`.

      Note that the paths are not maintained incrementally and in worst case the complexity of the path construction is O(|V|+|E|) (one depth-first graph traversal). There is no guarantee that the given path is the shortest one between the given two nodes.
      Parameters:
        `source` - the source node
        `target` - the target node
      Returns:
        a path between the nodes, or null if target is not reachable from source

    - #### getPathFinder

          IGraphPathFinder<V> getPathFinder()

      The returned `IGraphPathFinder` can be used to retrieve paths between nodes using transitive reachability.
      Returns:
        a path finder for the graph.

    - #### dispose

          void dispose()

      Call this method to properly dispose the data structures of a transitive closure algorithm.