
    wg                     :    d Z ddlZdgZej                  d        Zy)z2Helper functions for community-finding algorithms.    Nis_partitionc                     t        |t              st        |      }|D ch c]  }|D ]	  }|| v s|  }}}t        |       t        |      cxk(  xr t        d |D              k(  S c S c c}}w )a  Returns *True* if `communities` is a partition of the nodes of `G`.

    A partition of a universe set is a family of pairwise disjoint sets
    whose union is the entire universe set.

    Parameters
    ----------
    G : NetworkX graph.

    communities : list or iterable of sets of nodes
        If not a list, the iterable is converted internally to a list.
        If it is an iterator it is exhausted.

    c              3   2   K   | ]  }t        |        y w)N)len).0cs     r/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/networkx/algorithms/community/community_utils.py	<genexpr>zis_partition.<locals>.<genexpr>   s     &C!s1v&Cs   )
isinstancelistr   sum)Gcommunitiesr   nnodess        r	   r   r      sk    $ k4(;'#91Q9!q&Q9Q9E9q6SZC3&C{&C#CCCCC :s
   A+A+)__doc__networkxnx__all___dispatchabler        r	   <module>r      s/    8 
 D Dr   