  In this paper, we consider a two-way relay network in which two users
exchange messages through a single relay using a physical-layer network coding
(PNC) based protocol. The protocol comprises two phases of communication. In
the multiple access (MA) phase, two users transmit their modulated signals
concurrently to the relay, and in the broadcast (BC) phase, the relay
broadcasts a network-coded (denoised) signal to both users. Nonbinary and
binary network codes are considered for uniform and nonuniform pulse amplitude
modulation (PAM) adopted in the MA phase, respectively. We examine the effect
of different choices of symbol mapping (i.e., mapping from the denoised signal
to the modulation symbols at the relay) and bit mapping (i.e., mapping from the
modulation symbols to the source bits at the user) on the system error-rate
performance. A general optimization framework is proposed to determine the
optimal symbol/bit mappings with joint consideration of noisy transmissions in
both communication phases. Complexity-reduction techniques are developed for
solving the optimization problems. It is shown that the optimal symbol/bit
mappings depend on the signal-to-noise ratio (SNR) of the channel and the
modulation scheme. A general strategy for choosing good symbol/bit mappings is
also presented based on a high-SNR analysis, which suggests using a symbol
mapping that aligns the error patterns in both communication phases and Gray
and binary bit mappings for uniform and nonuniform PAM, respectively.
