def is_partition(G, partition):
    # Alternate implementation:
    #
    #     return (len(G) == sum(len(c) for c in community) and
    #             set(G) == set().union(*community))
    #
    return all(sum(1 if v in c else 0 for c in partition) == 1 for v in G)
Test multiple tiers of iterators
dataset/ETHPy150Open networkx/networkx/networkx/algorithms/community/quality.py/is_partition--crossover with--dataset/ETHPy150Open babble/babble/include/jython/Lib/test/test_heapq.py/L