A cognitive radio wireless network is investigated, in which a number of primary users (PUs) transmit in orthogonal frequency bands. There are also a number of secondary users (SUs) in the network, which monitor transmission opportunities in these frequency bands by collaboratively detecting whether each PU is transmitting. Each SU can participate in detecting only one PU's transmission at a time although it may locate in multiple PUs' detection ranges. A network management issue is studied, which addresses the best assignment of SUs to detecting PUs so that the overall probability of detection error is minimized. A distributed implementation of the elimination algorithm is proposed to efficiently find the best assignment by drawing connection between the current problem and the inference problem in the context of probabilistic graphic models. The graphic representation of the problem is also discussed.