aryagraph.algorithms.community.community_labels#

aryagraph.algorithms.community.community_labels(communities: Iterable[Iterable[Hashable]]) → NodeMap[source]#

NodeMap node → community index, where 0 is the largest community.

Equal-sized communities keep their given order. A node listed twice raises ValueError.

>>> community_labels([{"a"}, {"b", "c"}])
NodeMap('community', 3 nodes; top: {'a': 1, 'b': 0, 'c': 0})