connect() {
    this.disconnect();

    this.from = this.body.nodes[this.fromId] || undefined;
    this.to = this.body.nodes[this.toId] || undefined;
    this.connected = this.from !== undefined && this.to !== undefined;

    if (this.connected === true) {
      this.from.attachEdge(this);
      this.to.attachEdge(this);
    } else {
      if (this.from) {
        this.from.detachEdge(this);
      }
      if (this.to) {
        this.to.detachEdge(this);
      }
    }

    this.edgeType.connect();
  }
Connect an edge to its nodes