code: function assignLayerCandidate(vertices, incoming, outgoing, W, c, getTo) {
    const layerBelow = new Set()
    const assigned = new Set()
    const layers = [new Set()]
  
    let widthCurrent = 0
    let widthUp = 0
  
    while (assigned.size !== vertices.size) {
      let selected = null
      let selectedDegree = -Infinity
      let okay = true
      for (let vertex of vertices) {
        if (assigned.has(vertex)) {
          continue
        }
        let vertexOutgoing = outgoing.get(vertex) || φ
  
        okay = true
  
        // N+G(v) ⊆ Z
        for (let edge of vertexOutgoing) {
          if (!layerBelow.has(getTo(edge))) {
            okay = false
            break
          }
        }
  
        if (!okay && vertexOutgoing.size) continue
  
        if (selectedDegree < vertexOutgoing.size) {
          selectedDegree = vertexOutgoing.size
          selected = vertex
        }
      }
  
      if (selected) {
        layers[layers.length - 1].add(selected)
        assigned.add(selected)
        widthCurrent = widthCurrent - selectedDegree + 1
        widthUp = widthUp + (incoming.get(selected) || φ).size
      }
  
      if (!selected || (widthCurrent >= W && selectedDegree < 1) || widthUp >= W * c) {
        widthCurrent = widthUp
        widthUp = 0
        layers.push(new Set())
        for (let vertex of layers[layers.length - 2]) {
          layerBelow.add(vertex)
        }
      }
    }
  
    return layers
  }
docs: pick thinnest of W={1,2,3,4}, c={1,2}