## 4 Threading Statistical Disclosure Attack Algorithm with EM (TSDA-EM)
### Feasible Tables and Threads  
The procedure for obtaining feasible tables was first implemented at the BA [17], where each round is treated as an independent event. The first step is to determine the maximum number of feasible tables for each round, considering time constraints. This serves as the basis for the attack. To generate feasible tables, we use an algorithm based on [38]. This algorithm fills the table column by column, recalculating the bounds for each element before generating it. 1. **Start with the first column, first row:** Generate \(n_{11}\) from an integer uniform distribution within the bounds specified by Equation (3), where \(i=1\) and \(j=1\). Let \(r\) represent the number of rows. 2. **For each row element \(n_{k1}\) in this column:** If the elements up to \(k-1\) have been generated, recalculate the bounds for \(n_{k1}\) using Equation (3): \[\max\left(0,\left(n+1-\sum_{i=1}^{k-1}n_{i1}\right)-\sum_{i=k+1}^{r}n_{i+} \right)\leq n_{k1}\leq\min\left(n_{k+},n+1-\sum_{i=1}^{k-1}n_{i1}\right)\] (3) Then, generate \(n_{k1}\) using an integer uniform distribution within these new bounds. 3. **Automatically fill the last row element:** The last row element is filled automatically, since the lower and upper bounds coincide. Set \(n_{(k+1)+}\) to zero for convenience. 4. **Update after filling the first column:** After completing the first column, update the row margins \(n_{i+}\) and the total count \(n\) by subtracting the already fixed elements. The remaining table is treated as a new table with one fewer column. The algorithm continues filling each column until the entire table is completed. Figure 3 illustrates the differences between the previous algorithms and the proposed TSDA-EM. The BA algorithm (Figure 3a) was introduced in [17]. It takes anonymized email data as input, calculates the feasible tables using a uniform distribution, and subsequently infers whether communication exists (indicated by 1) or does not exist (indicated by 0) based on the likelihood of occurrence in the feasible tables. The OA algorithm (b), presented in [16], follows the same initial steps as BA but additionally iteratively refines \(\lambda_{s,r}\) using a Poisson distribution. By applying the Expectation-Maximization Algorithm, it further classifies whether communication exists or not. Finally, the TSDA-EM algorithm (c) builds on the previous versions but improves upon them by incorporating threading, significantly speeding up the process of calculating feasible tables. By performing multiple iterations and additional processes, TSDA-EM not only provides better results than its predecessors but also goes beyond simply inferring whether communication exists. It further infers the frequency of messages exchanged between (s, r). Additionally, Figure 3c indicates the section or subsection where each phase is explained in detail. Since the calculation of feasible tables is a non-sequential process, we deduced that the performance of the algorithm could significantly increase by incorporating parallel processing for each combination. In fact, we experimentally found that the best performance was achieved when the algorithm employed four threads: three for calculating feasible tables and a fourth for synchronizing the dataset generated by the other threads. From this point forward, we describe the innovations and contributions that differentiate TSDA-EM from previous approaches. One of the main challenges in parallel computing is the synchronization between processes, because threads frequently try to access the same data at the same time. The experiments described here had to run three parallel threads, each one with its own set of feasible tables T1, T2, and T3; see Figure 4. Notice that the intersections of each set represents repeated feasible tables. In order to obtain the final set of feasible tables, the fourth thread needs to synchronize the information, i.e., collect all the feasible tables that are not repeated in T1, T2, and T3.