docs: def _cuthill_mckee(vertices, vertices_neighbours):
      """Yield the Cuthill-McKee order for a connected, undirected graph.
  
      `Wikipedia
      <https://en.wikipedia.org/wiki/Cuthill%E2%80%93McKee_algorithm>`_ provides
      a good introduction to the Cuthill-McKee algorithm. The RCM algorithm
      attempts to order vertices in a graph such that their adjacency matrix's
      bandwidth is reduced. In brief the RCM algorithm is a breadth-first search
      with the following tweaks:
  
      * The search starts from the vertex with the lowest degree.
      * Vertices discovered in each layer of the search are sorted by ascending
        order of their degree in the output.
  
      .. warning::
  
          This function must not be called on a disconnected or empty graph.
  
      Returns
      -------
      [vertex, ...]
      """
      vertices_degrees = {v: sum(itervalues(vertices_neighbours[v]))
                          for v in vertices}
  
      peripheral_vertex = min(vertices, key=(lambda v: vertices_degrees[v]))
  
      visited = set([peripheral_vertex])
      cm_order = [peripheral_vertex]
      previous_layer = set([peripheral_vertex])
      while len(cm_order) < len(vertices):
          adjacent = set()
          for vertex in previous_layer:
              adjacent.update(vertices_neighbours[vertex])
          adjacent.difference_update(visited)
  
          visited.update(adjacent)
          cm_order.extend(sorted(adjacent, key=(lambda v: vertices_degrees[v])))
          previous_layer = adjacent
  
      return cm_order