mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 11:45:31 -05:00
add a test in CCGraph
This commit is contained in:
parent
89f30e2891
commit
7105221ff0
2 changed files with 7 additions and 1 deletions
|
|
@ -339,6 +339,12 @@ let topo_sort ?eq ?rev ?(tbl=mk_table 128) ~graph seq =
|
||||||
let idx_j = CCList.find_idx ((=)j) l |> CCOpt.get_exn |> fst in \
|
let idx_j = CCList.find_idx ((=)j) l |> CCOpt.get_exn |> fst in \
|
||||||
idx_i < idx_j) \
|
idx_i < idx_j) \
|
||||||
[ 42, 21; 14, 2; 3, 1; 21, 7; 42, 3]
|
[ 42, 21; 14, 2; 3, 1; 21, 7; 42, 3]
|
||||||
|
let l = topo_sort ~rev:true ~graph:divisors_graph (Seq.return 42) in \
|
||||||
|
List.for_all (fun (i,j) -> \
|
||||||
|
let idx_i = CCList.find_idx ((=)i) l |> CCOpt.get_exn |> fst in \
|
||||||
|
let idx_j = CCList.find_idx ((=)j) l |> CCOpt.get_exn |> fst in \
|
||||||
|
idx_i > idx_j) \
|
||||||
|
[ 42, 21; 14, 2; 3, 1; 21, 7; 42, 3]
|
||||||
*)
|
*)
|
||||||
|
|
||||||
(** {2 Lazy Spanning Tree} *)
|
(** {2 Lazy Spanning Tree} *)
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,7 @@ val topo_sort_tag : ?eq:('v -> 'v -> bool) ->
|
||||||
graph:('v, 'e) t ->
|
graph:('v, 'e) t ->
|
||||||
'v sequence ->
|
'v sequence ->
|
||||||
'v list
|
'v list
|
||||||
(** Same as {!topo_sort} *)
|
(** Same as {!topo_sort} but uses an explicit tag set *)
|
||||||
|
|
||||||
(** {2 Lazy Spanning Tree} *)
|
(** {2 Lazy Spanning Tree} *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue