o
    ˷ec                     @   s   d Z dgZdd ZdS )z2Helper functions for community-finding algorithms.is_partitionc                    sR   t |ts	t|} fdd|D }t t|  ko&tdd |D kS   S )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                    s"   h | ]}|D ]}| v r|qqS  r   ).0cnGr   d/var/www/ideatree/venv/lib/python3.10/site-packages/networkx/algorithms/community/community_utils.py	<setcomp>   s   " zis_partition.<locals>.<setcomp>c                 s   s    | ]}t |V  qd S )N)len)r   r   r   r   r   	<genexpr>   s    zis_partition.<locals>.<genexpr>)
isinstancelistr
   sum)r   communitiesnodesr   r   r   r      s   
.N)__doc____all__r   r   r   r   r   <module>   s    