

def reverse_cuthill_mckee_ordering(G, start=None):
    'Generate an ordering (permutation) of the graph nodes to make \n    a sparse matrix.\n\n    Uses the reverse Cuthill-McKee heuristic (based on breadth-first search) \n    [1]_.\n\n    Parameters\n    ----------\n    G : graph\n      A NetworkX graph \n\n    start : node, optional\n      Start algorithm and specified node.  The node should be on the \n      periphery of the graph for best results.  \n\n    Returns\n    -------\n    nodes : generator\n       Generator of nodes in reverse Cuthill-McKee ordering.\n\n    Examples\n    --------\n    >>> from networkx.utils import reverse_cuthill_mckee_ordering\n    >>> G = nx.path_graph(4)\n    >>> rcm = list(reverse_cuthill_mckee_ordering(G))\n    >>> A = nx.adjacency_matrix(G, nodelist=rcm) # doctest: +SKIP\n\n    See Also\n    --------\n    cuthill_mckee_ordering\n    \n    Notes\n    -----\n    The optimal solution the the bandwidth reduction is NP-complete [2]_.\n\n    References\n    ----------\n    .. [1] E. Cuthill and J. McKee.\n       Reducing the bandwidth of sparse symmetric matrices,\n       In Proc. 24th Nat. Conf. ACM, pages 157-72, 1969.\n       http://doi.acm.org/10.1145/800195.805928\n    .. [2]  Steven S. Skiena. 1997. The Algorithm Design Manual. \n       Springer-Verlag New York, Inc., New York, NY, USA.\n    '
    return reversed(list(cuthill_mckee_ordering(G, start=start)))

dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/utils/rcm.py reverse_cuthill_mckee_ordering/original