+ l
+ (*
+ Tas.sort_of_list tree l
+ List.sort (compare_node tree) l*)
+
+let rec compare_node_list tree l1 l2 =
+ match l1,l2 with
+ [],[] -> 0
+ | _,[] -> 1
+ | [],_ -> -1
+ | n1::ll1,n2::ll2 -> let b = compare_node tree n1 n2 in
+ if b=0 then compare_node_list tree ll1 ll2
+ else b
+
+let get_descendant tree ln =
+ let rec aux n acc =
+ if n == Naive_tree.nil then acc
+ else let n1 = Naive_tree.first_child tree n in
+ let acc1 = aux n1 (n::acc) in
+ let n2 = Naive_tree.next_sibling tree n in
+ let acc2 = aux n2 acc1 in
+ acc2
+ in
+ let l = List.fold_left (fun acc n -> if List.mem n acc then acc
+ else let n1 = Naive_tree.first_child tree n in
+ aux n1 acc) [] ln
+ in
+ List.rev l
+
+let get_child tree ln =
+ let rec aux n acc =
+ if n == Naive_tree.nil then acc
+ else
+ let n1 = Naive_tree.next_sibling tree n in
+ aux n1 (n::acc)
+ in
+ let ll = List.map (fun n->
+ let n1 = Naive_tree.first_child tree n in
+ let res = aux n1 [] in
+ List.rev res
+ ) ln in
+ List.fold_left (fun acc l -> union_list tree acc l) [] ll
+
+
+let get_followingSibling tree ln =
+ let rec aux n acc =
+ let n1 = Naive_tree.next_sibling tree n in
+ if n1 == Naive_tree.nil then acc
+ else aux n1 (n1::acc)
+ in
+ let ll = List.map (fun n -> let res = aux n [] in
+ List.rev res ) ln in
+ List.fold_left (fun acc l1 -> union_list tree acc l1) [] ll
+
+
+let rec get_firstBling tree n pred =
+ if n== Naive_tree.nil then pred
+ else get_firstBling tree (Naive_tree.prev_sibling tree n) n
+
+let get_parent tree ln =
+ let l = List.fold_left (fun acc n ->
+ let n1 = get_firstBling tree n Naive_tree.nil in
+ let n2 = Naive_tree.parent_of_first tree n1 in
+ if n2 == Naive_tree.nil or List.mem n2 acc then acc
+ else union_list tree [n2] acc
+ ) [] ln
+ in
+ l
+
+
+
+let get_ancestor tree ln =
+ let rec aux tree l1 acc =
+ match l1 with
+ [] -> acc
+ | _ -> let ll1 = get_parent tree l1 in
+ let acc1 = union_list tree acc ll1 in
+ aux tree ll1 acc1
+ in
+ let l = aux tree ln [] in
+ l
+
+let get_preSibling tree ln =
+ let rec aux n acc =
+ let n1 = Naive_tree.prev_sibling tree n in
+ if n1 == Naive_tree.nil then acc
+ else aux n1 (n1::acc)
+ in
+ let ll = List.map (fun n -> aux n [] ) ln in
+ List.fold_left (fun acc l1 -> union_list tree acc l1) [] ll
+