Returns an immutable copy of {@code graph}.
(Graph<N> graph)
| 54 | |
| 55 | /** Returns an immutable copy of {@code graph}. */ |
| 56 | public static <N> ImmutableGraph<N> copyOf(Graph<N> graph) { |
| 57 | return (graph instanceof ImmutableGraph) |
| 58 | ? (ImmutableGraph<N>) graph |
| 59 | : new ImmutableGraph<N>( |
| 60 | new StandardValueGraph<N, Presence>( |
| 61 | GraphBuilder.from(graph), getNodeConnections(graph), graph.edges().size())); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Simply returns its argument. |