## com.google.javascript.jscomp.graph
Class GraphReachability<N,E>

    java.lang.Object
      com.google.javascript.jscomp.graph.GraphReachability<N,E>

All Implemented Interfaces:
  FixedPointGraphTraversal.EdgeCallback<N,E>

    public class GraphReachability<N,E>

extends Object
implements FixedPointGraphTraversal.EdgeCallback<N,E>

Computes all the reachable nodes. Upon execution of `compute(Object)`, the graph nodes will be annotated with `REACHABLE` if it is reachable from the specified entry node.

See Also:
  `Annotatable.getAnnotation()`

Nested Class Summary
`static class` | `GraphReachability.EdgeTuple<N,E>` Represents Source Node, Edge and Destination Node.

Field Summary
`static Annotation` | `REACHABLE`

Constructor Summary
`GraphReachability(DiGraph<N,E> graph)`
`GraphReachability(DiGraph<N,E> graph, com.google.common.base.Predicate<GraphReachability.EdgeTuple<N,E>> edgePredicate)`

Method Summary
`void` | `compute(N entry)`
`void` | `recompute(N reachableNode)`
`boolean` | `traverseEdge(N source, E e, N destination)` Update the state of the destination node when the given edge is traversed.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### REACHABLE

    public static final Annotation REACHABLE

Constructor Detail

### GraphReachability

    public GraphReachability(DiGraph<N,E> graph)

### GraphReachability

    public GraphReachability(DiGraph<N,E> graph,
                             com.google.common.base.Predicate<GraphReachability.EdgeTuple<N,E>> edgePredicate)

Parameters:
  `graph` - The graph.
  `edgePredicate` - Given the predecessor P of the a node S and the edge coming from P to S, this predicate should return true if S is reachable from P using the edge.

Method Detail

### compute

    public void compute(N entry)

### recompute

    public void recompute(N reachableNode)

### traverseEdge

    public boolean traverseEdge(N source,
                                E e,
                                N destination)

  Description copied from interface: `FixedPointGraphTraversal.EdgeCallback`
  Update the state of the destination node when the given edge is traversed. For the fixed-point computation to work, only the destination node may be modified. The source node and the edge must not be modified.

  Specified by:
    `traverseEdge` in interface `FixedPointGraphTraversal.EdgeCallback<N,E>`
  Parameters:
    `source` - The start node.
    `e` - The edge.
    `destination` - The end node.
  Returns:
    Whether the state of the destination node changed.