This paper considers a relay-assisted bidirectional cellular network where the base station (BS) communicates with each mobile station (MS) using orthogonal frequency-division multiple-access (OFDMA) for both uplink and downlink. We first introduce a novel three-time-slot time-division duplexing (TDD) transmission protocol. This protocol unifies the direct transmission, one-way relaying and network-coded two-way relaying between the BS and each MS. Using the proposed TDD protocol, we then propose an optimization framework for resource allocation to achieve the following gains: cooperative diversity gain (via relay selection), network coding gain (via bidirectional transmission mode selection), and multiuser diversity gain (via subcarrier assignment). We formulate the problem as an integer programming problem. By establishing its equivalence with a maximum weighted clique problem (MWCP) in graph theory, we show that the problem can be solved using an ant colony optimization (ACO) based ...