code: public static <N, V> MutableValueGraph<N, V> copyOf(ValueGraph<N, V> graph) {
      MutableValueGraph<N, V> copy =
          ValueGraphBuilder.from(graph).expectedNodeCount(graph.nodes().size()).build();
      for (N node : graph.nodes()) {
        copy.addNode(node);
      }
      for (EndpointPair<N> edge : graph.edges()) {
        copy.putEdgeValue(
            edge.nodeU(), edge.nodeV(), graph.edgeValueOrDefault(edge.nodeU(), edge.nodeV(), null));
      }
      return copy;
    }
docs: Creates a mutable copy of {@code graph} with the same nodes, edges, and edge values.