/* This function counts states and * precomputes the post/pre sets * for each state * Therefore it simply traverses the tree * and expands the new found nodes * The counter "count" counts the outgoing transitions * of the current state to determine * if it is a terminal state * If it was we set terminal_encountered to true */ private void compute_pre_post_list() { Queue <T> to_be_expanded = new Queue <T>(); T initialState; transition_system.GetInitialState(out initialState); to_be_expanded.Enqueue(initialState); array.addToStates(initialState); int size = to_be_expanded.Count; while (size > 0) { int count = 0; var state = to_be_expanded.Dequeue(); T successor; foreach (var transition in transition_system.GetTransitions(ref state)) { count++; transition_system.GetTargetState(ref state, transition, out successor); if (array.addToStates(successor)) { to_be_expanded.Enqueue(successor); } int suc_ind = array.getIndex(successor); int state_ind = array.getIndex(state); array.addToPost(state, successor); array.addToPre(successor, state); } if (count == 0) { terminal_encountered = true; } int ind = array.getIndex(state); size = to_be_expanded.Count; } }