def METHOD_NAME(cases):
    """returns a list of case IDs in topological order according to their
    case indices
    """
    tree = defaultdict(set)
    for case_id, case in cases.items():
        tree[case_id]  # prime for case
        for index in case.index.values():
            tree[index.case_id].add(case_id)
    return toposort_flatten(tree)