android/guava/src/com/google/common/graph/Graphs.java
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;
  }
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;
  }
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 ; }
Creates a mutable copy of {@code network} with the same nodes and edges.
Creates a mutable copy of {