Module Graph__Path.Check
Check for a path.
Parameters
G : sig ... end
Signature
val create : G.t -> path_checkercreate gbuilds a new path checker for the graphg; if the graph is mutable, it must not be mutated while this path checker is in use (through the functioncheck_pathbelow).
val check_path : path_checker -> G.V.t -> G.V.t -> boolcheck_path pc v1 v2checks whether there is a path fromv1tov2in the graph associated to the path checkerpc.Complexity: The path checker contains a cache of all results computed so far. This cache is implemented with a hash table so access in this cache is usually O(1). When the result is not in the cache, Dijkstra's algorithm is run to check for the path, and all intermediate results are cached.
Note: if checks are to be done for almost all pairs of vertices, it may be more efficient to compute the transitive closure of the graph (see module
Oper).