create (nodeData) {
    var node = this.nodeFactory.create(nodeData.type, nodeData)
    if (!node) {
      throw new Error('Illegal argument: could not create node for data:', nodeData)
    }
    if (this.contains(node.id)) {
      throw new Error('Node already exists: ' + node.id)
    }
    if (!node.id || !node.type) {
      throw new Error('Node id and type are mandatory.')
    }
    this.nodes.set(node.id, node)

    const change = {
      type: 'create',
      node
    }

    if (this.__QUEUE_INDEXING__) {
      this.queue.push(change)
    } else {
      this._updateIndexes(change)
    }

    return node
  }
Create a node from the given data.

    @return {Node} The created node.