How to create Treeview manually by GoJS

I’m new at GoJs.
I found topic on the website about treeview. it generate an automatic tree with 500 nodes
I’m wondering how to create manual tree with GoJs

Could you please describe what you mean by “manual tree”?

I mean a tree that I create nodes one by one and is not a random tree, generated by a piece of “for, count, if & retun” codes such as:

// create a random tree
var nodeDataArray = [{ key: 0 }];
var max = 499;
var count = 0;
while (count < max) {
count = makeTree(3, count, max, nodeDataArray, nodeDataArray[0]);
myDiagram.model = new go.TreeModel(nodeDataArray);

function makeTree(level, count, max, nodeDataArray, parentdata) {
  var numchildren = Math.floor(Math.random() * 10);
  for (var i = 0; i < numchildren; i++) {
    if (count >= max) return count;
    var childdata = { key: count, parent: parentdata.key };
    if (level > 0 && Math.random() > 0.5) {
      count = makeTree(level - 1, count, max, nodeDataArray, childdata);
  return count;

Well, many of the samples generate random data just to varying graphs to show. To keep things simple they often do not show how to add nodes and links, because there are many ways of doing that and they are all quite independent of the other features being demonstrated by those samples, such as node design or diagram layout.

Some samples that involve user actions to edit a tree include: