N
- The type of data that the graph node holds.E
- The type of data that the graph edge holds.public final class GraphReachability<N,E> extends java.lang.Object implements FixedPointGraphTraversal.EdgeCallback<N,E>
compute(Object)
,
the graph nodes will be annotated with REACHABLE
if it is reachable
from the specified entry node.Annotatable.getAnnotation()
Modifier and Type | Class and Description |
---|---|
static class |
GraphReachability.EdgeTuple<N,E>
Represents a Source Node and an Edge.
|
Modifier and Type | Field and Description |
---|---|
static Annotation |
REACHABLE |
Constructor and Description |
---|
GraphReachability(DiGraph<N,E> graph) |
GraphReachability(DiGraph<N,E> graph,
com.google.common.base.Predicate<GraphReachability.EdgeTuple<N,E>> edgePredicate) |
Modifier and Type | Method and Description |
---|---|
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.
|
public static final Annotation REACHABLE
public GraphReachability(DiGraph<N,E> graph, com.google.common.base.Predicate<GraphReachability.EdgeTuple<N,E>> edgePredicate)
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.public void compute(N entry)
public void recompute(N reachableNode)
public boolean traverseEdge(N source, E e, N destination)
FixedPointGraphTraversal.EdgeCallback
Recall that depending on the direction of the traversal, source
and destination
may be swapped compared to the orientation of the edge in the graph. In either
case, only the destination
parameter may be mutated.
traverseEdge
in interface FixedPointGraphTraversal.EdgeCallback<N,E>
source
- The start node.e
- The edge.destination
- The end node.Copyright © 2009-2020 Google. All Rights Reserved.