getNewEdge = function (createdEdge) {
      for (let j = 0; j < newEdges.length; j++) {
        const newEdge = newEdges[j];

        // We replace both to and from edges with a single cluster edge
        const matchToDirection =
          createdEdge.fromId === newEdge.fromId &&
          createdEdge.toId === newEdge.toId;
        const matchFromDirection =
          createdEdge.fromId === newEdge.toId &&
          createdEdge.toId === newEdge.fromId;

        if (matchToDirection || matchFromDirection) {
          return newEdge;
        }
      }

      return null;
    }
Find a cluster edge which matches the given created edge.
@param {vis.Edge} createdEdge
@returns {vis.Edge}