code: function (from, to, edgeData) {
      edgeData = edgeData || {}
      edgeData.weight = Math.floor(Math.random() * 10) + 1;
      edgeData.label = edgeData.weight;
      edgeData.style = { 'pointer-events': 'none' }
      g.addEdge(from, to, edgeData);
    }
docs: /* modify the addEdge function to attach random weights