:param T_tot: total number of time steps to run the model.
:return: dictionary {layer j: last time t}
last = {}
curr_ind = [graph.number_of_nodes() - 1] // start with output layer
t = T_tot
while len(last) < graph.number_of_nodes():
next_ind = [] // layers at prev time point
for ind in curr_ind:
if ind not in last:
last[ind] = t
// then add adjacency list onto next_ind
next_ind.extend(graph.predecessors(ind))
curr_ind = next_ind