Generating photon-encodedWstates in multiport waveguide-array systems