lifecycles.LifeCycle.group_iterator

LifeCycle.group_iterator(tid: int | None = None) iter

returns an iterator over the groups of the LifeCycle. if a temporal id is provided, it will iterate over the groups observed at that time instant

Parameters:

tid – the temporal id of the groups to iterate over. Default is None

Returns:

an iterator over the groups

Example:

>>> lc = LifeCycle()
>>> lc.add_partition([[1,2], [3,4,5]])
>>> lc.add_partition([[1,2,3], [4,5]])
>>> for group in lc.group_iterator():
>>>     print(group)
>>> # {1, 2}
>>> # {3, 4, 5}
>>> # {1, 2, 3}
>>> # {4, 5}