code: function updateAncestorsInDragLayer(node, opts) {
      if (opts.inDragLayer == null && opts.addToList == null) {
        return;
      } // nothing to do
  
  
      if (!node.cy().hasCompoundNodes()) {
        return;
      } // find top-level parent
  
  
      var parent = node.ancestors().orphans(); // no parent node: no nodes to add to the drag layer
  
      if (parent.same(node)) {
        return;
      }
  
      var nodes = parent.descendants().spawnSelf().merge(parent).unmerge(node).unmerge(node.descendants());
      var edges = nodes.connectedEdges();
  
      if (opts.inDragLayer) {
        edges.forEach(setInDragLayer);
        nodes.forEach(setInDragLayer);
      }
  
      if (opts.addToList) {
        nodes.forEach(function (ele) {
          addToDragList(ele, opts);
        });
      }
    }
docs: helper function to determine which ancestor nodes and edges should go to the drag layer (or should be removed from drag layer).