let build_lc_index neighbourhoods depth index =
let result = Array.make depth [index] in
for i=1 to pred depth do
result.(i) <-
result.(pred i)
|> List.map (fun x -> x :: Array.to_list neighbourhoods.(x)) (* neighbourhoods.(x) doesn't contain x *)
|> List.flatten
|> Femtolib.List.stable_dedoublonne (*!! stable_dedoublonne_fast ?? *)
done;
(Array.map Array.of_list result : lc_index)