code: public static <N> ImmutableGraph<N> copyOf(Graph<N> graph) {
      return (graph instanceof ImmutableGraph)
          ? (ImmutableGraph<N>) graph
          : new ImmutableGraph<N>(
              new ConfigurableValueGraph<N, Presence>(
                  GraphBuilder.from(graph), getNodeConnections(graph), graph.edges().size()));
    }
docs: Returns an immutable copy of {@code graph}.