Commit ec7bb6fb authored by bguillaum's avatar bguillaum

robust shift

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@6868 7838e531-6607-4d57-9587-6c381814729c
parent 0a580238
......@@ -54,13 +54,13 @@ module G_node = struct
let remove_key node_id t =
try {t with next = Massoc.remove_key node_id t.next} with Not_found -> t
let merge_key src_id tar_id t =
let merge_key ?(strict=false) src_id tar_id t =
try Some {t with next = Massoc.merge_key src_id tar_id t.next}
with Massoc.Duplicate -> None
with Massoc.Duplicate -> if strict then None else Some t
let shift_out src_t tar_t =
let shift_out ?(strict=false) src_t tar_t =
try Some {tar_t with next = Massoc.disjoint_union src_t.next tar_t.next}
with Massoc.Not_disjoint -> None
with Massoc.Not_disjoint -> if strict then None else Some tar_t
let rm_out_edges t = {t with next = Massoc.empty}
......
......@@ -22,8 +22,8 @@ module G_node: sig
val remove_key: int -> t -> t
val merge_key: int -> int -> t -> t option
val shift_out: t -> t -> t option
val merge_key: ?strict:bool -> int -> int -> t -> t option
val shift_out: ?strict:bool -> t -> t -> t option
val rm_out_edges: t -> t
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment