docs: def breadth_first_vertex_order(vertices_resources, nets):
      """A generator which iterates over a set of vertices in a breadth-first
      order in terms of connectivity.
  
      For use as a vertex ordering for the sequential placer.
      """
      # Special case: no vertices, just stop immediately
      if len(vertices_resources) == 0:
          return
  
      # Enumerate the set of nets attached to each vertex
      vertex_neighbours = defaultdict(set)
      for net in nets:
          # Note: Iterating over a Net object produces the set of vertices
          # involved in the net.
          vertex_neighbours[net.source].update(net)
          for sink in net.sinks:
              vertex_neighbours[sink].update(net)
  
      # Perform a breadth-first iteration over the vertices.
      unplaced_vertices = set(vertices_resources)
      vertex_queue = deque()
      while vertex_queue or unplaced_vertices:
          if not vertex_queue:
              vertex_queue.append(unplaced_vertices.pop())
          vertex = vertex_queue.popleft()
  
          yield vertex
  
          vertex_queue.extend(v for v in vertex_neighbours[vertex]
                              if v in unplaced_vertices)
          unplaced_vertices.difference_update(vertex_neighbours[vertex])