2p/srclib/minimiza.c
/**
    __set_transitions (private function)
    Input:
        row *min_dfa: minimum automata table (states already discovered)
        uint8_t ***trans_tb: original automata table
        size_t nstates: number of states in trans_tb
        size_t min_states: number of states in min_dfa
        size_t alph_sz: size of the alphabet

    Returns:
        void

    Advanced description:
        It fills the transitions in the (row *) array, alloc'ing the state_to field
        in each cell of min_dfa and filling it up accordingly with the information
        in trans_tb
*/


void

Advanced description:
It fills the transitions in the (row *) array, alloc'ing the state_to field
in each cell of min_dfa and filling it up accordingly with the information
in trans_tb
void Advanced description : It fills the transitions in the ( row * ) array alloc ' ing the state_to field in each cell of min_dfa and filling it up accordingly with the information in trans_tb
void __set_transitions(row *min_dfa, uint8_t ***trans_tb, size_t nstates, size_t min_states, size_t alph_sz){
    for (size_t i = 0; i < min_states; i++) {
        uint8_t *state = cstate_get_states(min_dfa[i].state_from);
        min_dfa[i].state_to = calloc(alph_sz, sizeof(cstate *));
        size_t from = 0;
        for (size_t j = 0; state[j] == 0; from = ++j);
        for (size_t sym = 0; sym < alph_sz; sym++) {
            size_t delta = dfa_delta(trans_tb, nstates, from, sym);
            size_t idx = __find_min_state(min_dfa, min_states, delta);
            min_dfa[i].state_to[sym] = cstate_copy(min_dfa[idx].state_from);
        }
    }
}
void __set_transitions ( row * min_dfa , uint8_t * * * trans_tb , size_t nstates , size_t min_states , size_t alph_sz ) { for ( size_t i = 0 ; i < min_states ; i ++ ) { uint8_t * state = cstate_get_states ( min_dfa [ i ] . state_from ) ; min_dfa [ i ] . state_to = calloc ( alph_sz , sizeof ( cstate * ) ) ; size_t from = 0 ; for ( size_t j = 0 ; state [ j ] == 0 ; from = ++ j ) ; for ( size_t sym = 0 ; sym < alph_sz ; sym ++ ) { size_t delta = dfa_delta ( trans_tb , nstates , from , sym ) ; size_t idx = __find_min_state ( min_dfa , min_states , delta ) ; min_dfa [ i ] . state_to [ sym ] = cstate_copy ( min_dfa [ idx ] . state_from ) ; } } }
__set_transitions (private function)
Input:
row *min_dfa: minimum automata table (states already discovered)
uint8_t ***trans_tb: original automata table
size_t nstates: number of states in trans_tb
size_t min_states: number of states in min_dfa
size_t alph_sz: size of the alphabet
__set_transitions ( private function ) Input : row * min_dfa : minimum automata table ( states already discovered ) uint8_t *** trans_tb : original automata table size_t nstates : number of states in trans_tb size_t min_states : number of states in min_dfa size_t alph_sz : size of the alphabet
// for each state in min_dfa
 // alloc memory for the transition array
 // find first single state present in the state of the min_dfa
 // for each symbol in the alphabet
 // find state index in the original table that we transverse to, from first state found
 // find state index for such state in the minimum dfa table
 // sets a copy of such state in the corresponding cell of min_dfa transition array
