let averageTwoStepReach graph =
    let module S = Set.Make(struct type t = G.vertex let compare = compare endin
    let n = float_of_int (G.nb_vertex graph) in
    let t = 
      G.fold_vertex (fun i0 total ->
        let s = 
          G.fold_succ (fun i1 set1 ->
            G.fold_succ (fun i2 set2 ->
              S.add i2 set2
            ) graph i1 set1
          ) graph i0 (S.empty)
        in total +. (float_of_int (S.cardinal s));
      ) graph 0.0
    in t /. n