code: public static WeightedIntDiGraph fromUnweighted(IntDiGraph g, Function<DiEdge, Double> makeDefaultWeight) {
          WeightedIntDiGraph wg = new WeightedIntDiGraph(makeDefaultWeight);
          wg.addAll(g);
          return wg;
      }
docs: Constructs a weighted directed graph with the same nodes and edges as
  the given unweighted graph