code: def update(ev):
      global pos, edges, lines, markers, view, force, dist, i
  
      dx = np.empty((npts, npts, 2), dtype="float32")
      dx[:] = pos[:, np.newaxis, :]
      dx -= pos[np.newaxis, :, :]
  
      dist = (dx**2).sum(axis=2) ** 0.5
      dist[dist == 0] = 1.0
      ndx = dx / dist[..., np.newaxis]
  
      force = np.zeros((npts, npts, 2), dtype="float32")
  
      # all points push away from each other
      force -= 0.1 * ndx / dist[..., np.newaxis] ** 2
  
      # connected points pull toward each other
      # pulsed force helps to settle faster:
      s = 0.1
      # s = 0.05 * 5 ** (np.sin(i/20.) / (i/100.))
  
      # s = 0.05 + 1 * 0.99 ** i
      mask = np.zeros((npts, npts, 1), dtype="float32")
      mask[edges[:, 0], edges[:, 1]] = s
      mask[edges[:, 1], edges[:, 0]] = s
      force += dx * dist[..., np.newaxis] * mask
  
      # points do not exert force on themselves
      force[np.arange(npts), np.arange(npts)] = 0
  
      force = force.sum(axis=0)
      pos += np.clip(force, -3, 3) * 0.09
  
      lines.set_data(pos=pos)
      markers.set_data(pos=pos, face_color=colors)
  
      i += 1
  
label_desc: Use image node_id 1 for calling a global function with example usage: update(ev) without return types