Class CheckPathsBetweenNodes<N,E>
java.lang.Object
com.google.javascript.jscomp.graph.CheckPathsBetweenNodes<N,E>
- Type Parameters:
N- The node type.E- The edge type.
See constructor,
CheckPathsBetweenNodes(DiGraph, DiGraphNode, DiGraphNode, Predicate, Predicate), for a
description of this algorithm.-
Constructor Summary
ConstructorsConstructorDescriptionCheckPathsBetweenNodes(DiGraph<N, E> graph, DiGraph.DiGraphNode<N, E> a, DiGraph.DiGraphNode<N, E> b, com.google.common.base.Predicate<N> nodePredicate, com.google.common.base.Predicate<DiGraph.DiGraphEdge<N, E>> edgePredicate) Inclusive check.CheckPathsBetweenNodes(DiGraph<N, E> graph, DiGraph.DiGraphNode<N, E> a, DiGraph.DiGraphNode<N, E> b, com.google.common.base.Predicate<N> nodePredicate, com.google.common.base.Predicate<DiGraph.DiGraphEdge<N, E>> edgePredicate, boolean inclusive) Given a graph G with nodes A and B, this algorithm determines if all paths from A to B contain at least one node satisfying a given predicate. -
Method Summary
Modifier and TypeMethodDescriptionbooleanboolean
-
Constructor Details
-
CheckPathsBetweenNodes
public CheckPathsBetweenNodes(DiGraph<N, E> graph, DiGraph.DiGraphNode<N, E> a, DiGraph.DiGraphNode<N, E> b, com.google.common.base.Predicate<N> nodePredicate, com.google.common.base.Predicate<DiGraph.DiGraphEdge<N, E>> edgePredicate, boolean inclusive) Given a graph G with nodes A and B, this algorithm determines if all paths from A to B contain at least one node satisfying a given predicate.Note that nodePredicate is not necessarily called for all nodes in G nor is edgePredicate called for all edges in G.
- Parameters:
graph- Graph G to analyze.a- The node A.b- The node B.nodePredicate- Predicate which at least one node on each path from an A node to B (inclusive) must match.edgePredicate- Edges to consider as part of the graph. Edges in graph that don't match edgePredicate will be ignored.inclusive- Includes node A and B in the test for the node predicate.
-
CheckPathsBetweenNodes
public CheckPathsBetweenNodes(DiGraph<N, E> graph, DiGraph.DiGraphNode<N, E> a, DiGraph.DiGraphNode<N, E> b, com.google.common.base.Predicate<N> nodePredicate, com.google.common.base.Predicate<DiGraph.DiGraphEdge<N, E>> edgePredicate) Inclusive check.
-
-
Method Details
-
allPathsSatisfyPredicate
public boolean allPathsSatisfyPredicate()- Returns:
- true iff all paths contain at least one node that satisfy the predicate
-
somePathsSatisfyPredicate
public boolean somePathsSatisfyPredicate()- Returns:
- true iff some paths contain at least one node that satisfy the predicate
-