def gen_equal_partition(n, total): all_nodes = np.arange(total) n_blocks = list(map(len, np.array_split(all_nodes, n))) return n_blocks