Bounds() }
      if (zoomID) {
        const n = node.data().find(d => d.id === zoomID)
        if (n !== undefined) {
          svg.call(zoom.transform, d3.zoomIdentity.scale(1).translate(-n.x, -n.y))
        }
      }
    })

  restartSimulation(true)
}

function restartSimulation (first) {
  // Expand selection
  let newNodes = []; let newLinks = []
  if (expand === -1) { // Expand all
    newNodes = nodes
    newLinks = links
  } else {
    const nodeSet = new Set(selected)
    const linkSet = new Set()