In SelectionDeleting how to detect the node which is going to be deleted

Hi,
I was using SelectionDeleting Event to join link of the node’s parent who is going to be deleted to the node’s child(s).
Here I tried to use e.subject but even when i am trying to delete single node it is giving the set of 2 nodes.
Can you please guide, that i am going on right direction and if so how to approach further,
So that i can identify node and can add link from it’s parent to its all childs.

Here is one way to do it. You will want to examine it carefully and adapt the code to make sure it meets your requirements.

<!DOCTYPE html>
<html>
<head>
<title>Minimal GoJS Sample</title>
<!-- Copyright 1998-2020 by Northwoods Software Corporation. -->
<meta charset="UTF-8">
<script src="go.js"></script>
<script id="code">
  function init() {
    var $ = go.GraphObject.make;

    myDiagram =
      $(go.Diagram, "myDiagramDiv",
        {
          "undoManager.isEnabled": true,
          layout: $(go.TreeLayout),
          "SelectionDeleting": function(e) {
            e.subject.each(function(node) {
              if (!(node instanceof go.Node)) return;
              node.findNodesInto().each(function(from) {
                node.findNodesOutOf().each(function(to) {
                  // don't create duplicate links??
                  if (from.findLinksTo(to).count > 0) return;
                  var model = to.diagram.model;
                  // NOTE: simplify this code depending on which kind of model you are using
                  if (model instanceof go.GraphLinksModel) {
                    var newlinkdata = {};  // add whatever properties you need
                    model.setFromKeyForLinkData(newlinkdata, from.key);
                    model.setToKeyForLinkData(newlinkdata, to.key);
                    model.addLinkData(newlinkdata);
                  } else if (model instanceof go.TreeModel) {
                    model.setParentKeyForNodeData(to.data, from.key);
                  }
                });
              });
            });
          }
        });

    myDiagram.nodeTemplate =
      $(go.Node, "Auto",
        $(go.Shape,
          { fill: "white", portId: "", fromLinkable: true, toLinkable: true, cursor: "pointer" },
          new go.Binding("fill", "color")),
        $(go.TextBlock,
          { margin: 8, editable: true },
          new go.Binding("text").makeTwoWay())
      );

    myDiagram.model = new go.GraphLinksModel(
    [
      { key: 1, text: "Alpha", color: "lightblue" },
      { key: 2, text: "Beta", color: "orange" },
      { key: 3, text: "Gamma", color: "lightgreen" },
      { key: 4, text: "Delta", color: "pink" },
      { key: 5, text: "Epsilon", color: "yellow" }
    ],
    [
      { from: 1, to: 2 },
      { from: 1, to: 3 },
      { from: 3, to: 4 },
      { from: 3, to: 5 }
    ]);
  }
</script>
</head>
<body onload="init()">
  <div id="myDiagramDiv" style="border: solid 1px black; width:100%; height:600px"></div>
</body>
</html>