   { from: 1, to: 2 },
        { from: 1, to: 3 },
        { from: 2, to: 4 },
        { from: 3, to: 4 },
        { from: 4, to: 5 }
      ]
    );

    loop(); // start a simple simulation
  }

  function loop() {
    setTimeout(() => {
      myDiagram.commit((diag) => {
        diag.links.each((l) => {
          if (Math.random() < 0.2) return;
          var prev = l.fromNode.data.value;
          var now = l.toNode.data.value;
          if (prev > (l.fromNode.data.min || 0) && now < (l.toNode.data.max |