U
    ?hc                     @   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oLt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 ]}| kr|qqS  r   ).0cnGr   _/var/www/html/venv/lib/python3.8/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   ZcommunitiesZnodesr   r   r   r      s    
N)__doc____all__r   r   r   r   r   <module>   s   