From ffbe617c8624986d366321578b70fe9adb72f722 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 31 Mar 2013 21:28:40 +0200 Subject: [PATCH] LazyGraph.is_dag_full, with several starting vertices --- lazyGraph.ml | 7 +++++++ lazyGraph.mli | 3 +++ 2 files changed, 10 insertions(+) diff --git a/lazyGraph.ml b/lazyGraph.ml index 4fb9246b..c54f86d6 100644 --- a/lazyGraph.ml +++ b/lazyGraph.ml @@ -444,6 +444,13 @@ let is_dag graph v = | _ -> true) (Full.dfs_full graph (Gen.singleton v)) +let is_dag_full graph vs = + Gen.for_all + (function + | Full.MeetEdge (_, _, _, Full.EdgeBackward) -> false + | _ -> true) + (Full.dfs_full graph vs) + (** Reverse the path *) let rev_path p = let rec rev acc p = match p with diff --git a/lazyGraph.mli b/lazyGraph.mli index b5d3a18c..21ebada1 100644 --- a/lazyGraph.mli +++ b/lazyGraph.mli @@ -161,6 +161,9 @@ val is_dag : ('id, _, _) t -> 'id -> bool (** Is the subgraph explorable from the given vertex, a Directed Acyclic Graph? *) +val is_dag_full : ('id, _, _) t -> 'id Gen.t -> bool + (** Is the Graph reachable from the given vertices, a DAG? See {! is_dag} *) + val rev_path : ('id, 'e) path -> ('id, 'e) path (** Reverse the path *)