Class CheckPathsBetweenNodes<N,​E>

    • Constructor Detail

      • 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.
    • Method Detail

      • 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