def _calculate_to_transitions(trans_probs):
    """Calculate which 'to transitions' are allowed for each state

    This looks through all of the trans_probs, and uses this dictionary
    to determine allowed transitions. It converts this information into
    a dictionary, whose keys are destination states and whose values are
    lists of source states from which the destination is reachable via a
    transition.
    """
    transitions = dict()
    for from_state, to_state in trans_probs:
        try:
            transitions[to_state].append(from_state)
        except KeyError:
            transitions[to_state] = [from_state]

    return transitions