regarding your second question, please see the extensive documentation
and examples in the gr-trellis directory.
In summary: the input argument of trellis_encoder is NOT two
that would restrict these functions to trellises pertaining to
convolutional codes. Instead the argument is an FSM (finite state
machine) object that is generated using one of the many given
constructors including one that you want (ie, using polynomials)
let me know if you have any questions on the documentation and examples,