MCPcopy
hub / github.com/google/guava / copyOf

Method copyOf

guava/src/com/google/common/graph/Graphs.java:640–649  ·  view source on GitHub ↗

Creates a mutable copy of {@code graph} with the same nodes and edges.

(Graph<N> graph)

Source from the content-addressed store, hash-verified

638
639 /** Creates a mutable copy of {@code graph} with the same nodes and edges. */
640 public static <N> MutableGraph<N> copyOf(Graph<N> graph) {
641 MutableGraph<N> copy = GraphBuilder.from(graph).expectedNodeCount(graph.nodes().size()).build();
642 for (N node : graph.nodes()) {
643 copy.addNode(node);
644 }
645 for (EndpointPair<N> edge : graph.edges()) {
646 copy.putEdge(edge.nodeU(), edge.nodeV());
647 }
648 return copy;
649 }
650
651 /** Creates a mutable copy of {@code graph} with the same nodes, edges, and edge values. */
652 public static <N, V> MutableValueGraph<N, V> copyOf(ValueGraph<N, V> graph) {

Callers 9

validateGraphStateMethod · 0.95
validateGraphMethod · 0.95
validateNetworkMethod · 0.95
ignoreCaseMethod · 0.45
growMethod · 0.45
combineBuffersMethod · 0.45
toByteArrayMethod · 0.45
joinMethod · 0.45
hashMethod · 0.45

Calls 15

fromMethod · 0.95
fromMethod · 0.95
fromMethod · 0.95
sizeMethod · 0.65
nodesMethod · 0.65
addNodeMethod · 0.65
edgesMethod · 0.65
putEdgeMethod · 0.65
putEdgeValueMethod · 0.65
edgeValueOrDefaultMethod · 0.65
incidentNodesMethod · 0.65
addEdgeMethod · 0.65

Tested by 5

validateGraphStateMethod · 0.76
validateGraphMethod · 0.76
validateNetworkMethod · 0.76
combineBuffersMethod · 0.36
toByteArrayMethod · 0.36