connect(callback) {
    /**
     * @param {string} key
     * @param {string} method
     * @returns {Promise<any>}
     */
    const handleAll = (key, method) => this.graph[key]
      .reduce((chain, entity) => chain
        .then(() => this[method](entity, {
          initial: true,
        })), Promise.resolve());

    const promise = Promise.resolve()
      .then(() => handleAll('nodes', 'addNode'))
      .then(() => handleAll('edges', 'addEdge'))
      .then(() => handleAll('initializers', 'addInitial'))
      .then(() => handleAll('nodes', 'addDefaults'))
      .then(() => this);
    if (callback) {
      deprecated('Providing a callback to Network.connect is deprecated, use Promises');
      promise.then(() => {
        callback(null);
      }, callback);
    }
    return promise;
  }
@param {ErrorableCallback} [callback]
@returns {Promise<this>}