Interface PathValidator<V,​E>

  • Type Parameters:
    V - the graph vertex type
    E - the graph edge type

    public interface PathValidator<V,​E>
    Path validator for shortest path algorithms. Shortest path algorithms typically maintain a set of partial paths which are iteratively extended until some stopping criterion is met, e.g. the target vertex is reached. A path validator can be used to enforce additional criteria as to the validity of a given path. A partial path can only be extended by another edge if the path validator deems this extension feasible. As per example, a path validator can be used to enforce that a path connecting a source to a terminal vertex visits at least $n$ vertices.
    Author:
    Assaf Mizrachi
    • Method Detail

      • isValidPath

        boolean isValidPath​(GraphPath<V,​E> partialPath,
                            E edge)
        Checks if an edge can be added to a previous path element.
        Parameters:
        partialPath - the path from source vertex up to the current vertex.
        edge - the new edge to be added to the path.
        Returns:
        true if edge can be added, false otherwise.