code: public static <N, E> MutableNetwork<N, E> copyOf(Network<N, E> network) {
      MutableNetwork<N, E> copy =
          NetworkBuilder.from(network)
              .expectedNodeCount(network.nodes().size())
              .expectedEdgeCount(network.edges().size())
              .build();
      for (N node : network.nodes()) {
        copy.addNode(node);
      }
      for (E edge : network.edges()) {
        EndpointPair<N> endpointPair = network.incidentNodes(edge);
        copy.addEdge(endpointPair.nodeU(), endpointPair.nodeV(), edge);
      }
      return copy;
    }
docs: Creates a mutable copy of {@code network} with the same nodes and edges.