let removezdp graph =
    let g = G.copy graph in
    G.iter_vertex (fun v ->
      if G.in_degree graph v = 0 && G.out_degree graph v = 0 then
        G.remove_vertex g v;
    ) graph;
    g