def strongly_connected_components(G):
    """Returns the strongly connnected components of G as frozensets.

    SCC is a good test of the toposort algorithm just described. See
    [CLR] for more details. Constructing the components as frozensets
    simplifies their use.

    The following iterator pipeline will return the components in
    order of decreasing size:

    sorted(strongly_connected_components(G), key=len, reverse=True)
    """
    
    ordering = toposort(G)
    R = reverse(G)
    coloring = dict()
    for v in ordering:
        component = frozenset(w for w in DFS_visit(R, coloring, v))
        if component:
            yield component
Returns the strongly connnected components of G as frozensets.

    SCC is a good test of the toposort algorithm just described. See
    [CLR] for more details. Constructing the components as frozensets
    simplifies their use.

    The following iterator pipeline will return the components in
    order of decreasing size:

    sorted(strongly_connected_components(G), key=len, reverse=True)
    
recipes/Python/498260_Examples_algorithm_compositiobserver_pattern/recipe-498260.py