let next_edge cfg n =
  let edges = match !n.kind with
    | VblkIn _ | Vswitch _ | Vtest _ | Vloop _ ->
        let edges = CFG.succ_e cfg.graph n in
          List.filter (fun e -> (edge_type e) = Enext) edges
    | VcallIn _ ->
        let en, _ee = get_call_out_edges cfg n in [en]
    | VcallOut _ | VcallExit _
    | Vstmt _ -> CFG.succ_e cfg.graph n
    | _ -> 
        Wp_parameters.debug ~level:3 
          "[cfg:next_edge] not found for %a@." pp_node n;
        raise Not_found (* No Enext information on this node *)
  in
    match edges with
      | [] -> (* can append when nodes have been removed *) raise Not_found
      | [e] -> e
      | _ -> Wp_parameters.fatal "several Enext edges to node %a" pp_node n