Nodal and Edge Element Formulations for Waveguide Discontinuities