def _graph_indices(T, changepoints):
"""Describes which graphs are active for each time
by returning a list with the graphs indices
Parameters
----------
T : int
number of total timesteps
changepoints : list[int]
list of changepoint indices
Yields
------
Graph indices for all t < T
"""
graph = count = 0
for cp in changepoints:
while count < cp:
count += 1
yield graph
graph += 1
while count < T:
count += 1
yield graph
评论列表
文章目录