Gojs.net -> samples -> DOM Tree : Update Graph after new elements are insert

Do this part of the init function again:

    var nodeDataArray = [];
    // build up the tree
    traverseDom(document.activeElement, null);

    // create the model for the DOM tree
    myDiagram.model =
      $(go.TreeModel, {
        isReadOnly: true,  // don't allow the user to delete or copy nodes
        nodeDataArray: nodeDataArray
      });

I highly recommend that you learn about how to use GoJS by reading Get Started with GoJS and then all of the Introduction pages: GoJS Introduction -- Northwoods Software.