Factory out use of Objects.requireNonNull in GraphFactory.