## 5 Experiments and Results
### Results  
In this section, we present the results obtained and examine the behavior of the centralized model (FedAVG) and various decentralized FedP2P architecture variants, taking into account both IID and non-IID data distributions. An initial observation indicates that the FedP2P architecture, considering all the heuristics, appears to yield stable results compared to those obtained by the centralized FedAVG architecture. A detailed discussion of these results is provided in the discussion section. In Figure 6(a), which considers IID data, it is observed that all algorithms exhibit a linear increase in the number of models sent as the fraction of clients grows. However, the slope of this increase varies among different algorithms, depending on the heuristics used, denoted as H0, H1, H2, and H3. Notably, P2P-H0-AVG and P2P-H0-SGD show a steeper slope, indicating a higher communication cost with increasing client participation. In contrast, algorithms with heuristics H1, H2, and H3 demonstrate more moderate increases, suggesting better communication efficiency. Figure 6(b) presents a similar analysis but for non-IID data, which is more representative of real-world scenarios, where data are unevenly distributed across clients. The trends are comparable to those in Figure 6(a), with all algorithms experiencing an increase in the number of models sent as more clients participate. Nevertheless, the rate of increase is generally lower for non-IID data, particularly for algorithms utilizing heuristics H1, H2, and H3. This suggests that while the communication overhead is still present, these algorithms are potentially more robust to the challenges posed by non-IID data. In both IID and non-IID scenarios, the SGD variants generally exhibit higher communication costs than their AVG counterparts, which could be attributed to the more frequent model updates required by SGD. The impact of this difference is more pronounced in the IID data scenario. Figure 7: Cont. Figure 8 shows the learning performance of two different centralized federated learning algorithms--FedAVG and FedSGD--under both IID and non-IID data conditions. The graphs show the f1-score as it relates to the number of communication rounds between the central server and clients, with a threshold f1-score of 0.9 marked for reference. The threshold of 0.9 is a significant benchmark, representing a high level of model performance in terms of both precision and recall. Figure 8b shows the performance of the centralized FedAVG with non-IID data. The threshold is reached when communication round = 4. It should be noted that at communication round = 8, centralized FedAVG with non-IID data is still learning. Figure 8: Execution of centralized FedAVG and FedSGD with f1-score threshold set at 0.9. Figure 7: A comparison of FedAVGP2P to FedSGDP2P considering models sent in the network when 90% model accuracy was reached. C is the fraction of clients that the central server (or every client with FedAVGP2P) had received updates from. According to the graph above, it can be said that Heuristic 1 has the best learning ability when we increase factor C.  
Figure 8c presents the centralized FedSGD algorithm on IID data. The f1-score threshold is crossed when communication rounds equal 4. Figure 8d displays the centralized FedSGD algorithm on non-IID data. The model reaches the f1-score threshold when the communication round is 4, and it peaks when the communication round is 7. This implies that FedSGD struggles with learning from non-IID data and requires additional rounds. Figure 9 shows the performance of peer-to-peer federated learning algorithms, specifically FedAVG and FedSGD, with an f1-score threshold set at 0.9 and Heuristic 0 when the fraction of clients is varied. Figure 9a,b show the results from the execution of FedAVGP2P on IID and non-IID data, respectively. Across both data types, the threshold is crossed at the same time, despite varying the number of clients. Figure 9c,d show the execution for FedSGD2P.