# Detection of Transmission State of Multiple Wireless Sources: A Statistical Mechanics Approach
## 6 Simulation Results  
In this section, we numerically generate instances of two-dimensional primary-secondary networks with the aim of validating the above-discussed algorithm. The parameters and their values used in all the simulation scenarios can be seen in Table 4, where only the path-loss coefficient and the probability of a source being active have fixed values \(\gamma=4\) and \(\mathbb{P}_{\alpha}=0.5\), respectively, without loss of generality. The communication range, along with the average densities of the primary sources and SUs in a certain area, varies in each case to capture the fluctuations of the error detection rate. We start by showing that the proposed message-passing algorithm converges rapidly. Indeed, Figure 4b depicts the results from the simulation process regarding the convergence rate of the message-passing algorithm for various neighboring matrices, which differ not only in size, revealing the number of SUs and sources, but also in the connectivity between SUs and sources. As can be seen, the proposed algorithm converges very fast to the optimal solution. The SNR has been kept fixed, equal to \(\texttt{SNR}=0\) dB without loss of generality. The appealing aspect of our belief propagation algorithm is its linear complexity, which constitutes a competitive advantage compared to other algorithms. Next, we analyze the level of accuracy of the analytic approach from Equations (35) and (36), which are solved using population dynamics, and compare the results with an Erdos-Renyi random graph with the same parameters. Figure 4a depicts the error detection rate for the two algorithms we used, i.e., the message-passing and population dynamics algorithms. As can be seen, both algorithms demonstrate extremely good performance agreement. Further, it is important to compare the behavior of realistic two-dimensional networks. To this end, we generated 100 random instantiations of a network formed by \(5\times 5\) and \(10\times 10\) SUs and primary sources, respectively, with one such instantiation depicted in Figure 5a. The average error detection probability was evaluated for various values of the SNR using the population dynamics algorithm. Figure 6 shows a comparison of the two results with good agreement. Figure 4: (a) Error detection rate as a function of the SNR for the message-passing algorithm and the population dynamics method in a random network. The network structure for testing these two algorithms consisted of 10 primary sources and 10 SUs with a random degree of connectivity between them. As can be seen, both algorithms exhibit similar performance. It is worth highlighting the fact that the small difference between these two curves at high SNR values lies in the presence of loops in the tree structure that we have assumed. (b) Convergence of the message-passing algorithm in random networks with various connectivity matrices for fixed \(\texttt{SNR}=0\) dB. The algorithm scales linearly with the number of sources (in this tentative simulation, equal to \(n_{t}=12\)) which, as expected, converges in the same number of iterations. The convergence depends only on the number of sources per sensor and not on the size of the neighborhood matrix, as can be seen. The error detection rate is fixed after a specific number of iterations, simplifying the complexity of the proposed algorithm. Figure 5: (a) A single instantiation of a \(20\times 20\) random network. (b) Error detection rate for the network of (a). The red line represents the performance of myopic SU and the blue line represents the population dynamics algorithm. Note that above 0 dB, the proposed algorithm based on belief propagation outperforms the simple case of single-source detection. Interestingly, there is no phase transition, i.e., an error-free area, for the problem of multi-source detection. This can be easily demonstrated if one implements the message-passing algorithm with a strongly positive initial field (ferromagnetic) and compares it to the one with a random initial field (paramagnetic) [55].