let in_degree g v = fold_pred (fun _ -> succ) g v 0