## 5 The Labeling Algorithm for Four-Label Enumeration Stable Extension
### Four-Label Algorithm Description
However, in practice, self-attacking arguments may also contain contradictory arguments (e.g., self-attacking arguments that are not attacked by any other arguments) that cannot be legally labeled as _out_. Therefore, self-attacking arguments should be labeled as _must_out_ first to facilitate legality checks. Similarly, contradictory arguments will also arise in the labeling transition strategy, requiring special marking with _must_out_ labels for legality checks, thereby improving the algorithm's efficiency. Algorithm 2 illustrates the preprocessing procedure; here, \(x\) refers to an argument selected from the set \(A\), with the _blank_ label representing arguments that have not been labeled. It defines three useful mappings, and the subsequent operations of the algorithm are based on them. The labels in the mapping functions are _blank_, _must_out_, and _must_in_. Specifically, self-attacking arguments are labeled with _must_out_, initial arguments that are not attacked by any other arguments are labeled with _must_in_, and all other arguments are labeled as _blank_ (lines 2-10). Next, the algorithm stores the resulting _must_in_ arguments in set \(S\), and then it prioritizes checking whether set \(S\) is empty. If \(S\) is not empty, the arguments in \(S\) are subjected to the _in_ transition (lines 11-12). Otherwise, the algorithm moves to the stage of selecting _blank_ arguments. This preprocessing strategy is similar to methods used for solving grounded extensions. ```
Input:\(\Gamma=\langle A,R\rangle\), \(Lab:A\rightarrow\{\) blank, \(must\_out\), \(must\_in\}\), \(S\), \(I\), \(N\subseteq A\); Output:\(Lab:A\rightarrow\{\) blank, \(in\), \(out\), \(must\_out\}\);
1 begin
2 foreach\(x\in A\)do
3\({}^{*}N\) is a set of self-attacking arguments. */
4 if\(x\in N\)then
5\(Lab(x)=must\_out\);
6
7\({}^{*}I\) is a set initial arguments. */
8 if\(x\in I\)then
9\(Lab(x)=must\_in\);
10\(S\leftarrow\{(x|Lab(x)=must\_in)\}\); /*S is stack of arguments labeled as \(must\_in\). */
11\(Lab(x)=blank\);
12
13 if\(S\) is not empty for \(must\_in\)then
14\(in\)-\(trans(\)\(\)\(x\), \(\Gamma\), \(Lab)\); /*call for Algorithm 3*/
```  
**Algorithm 2**Preprocessing Labels  
**Labeling Transition Strategy. ** After the preprocessing is finished, the algorithm proceeds with a labeling transition and a legality check. First, the algorithm selects arguments that have not been labeled for the labeling transition, following the transition rules for \(in\) and \(must\_out\) labels. The labeling transition process is a binary tree searching framework, which tends to perform better than other multi-branch structures in algorithms. When all arguments have been labeled, the algorithm performs a legality check on the labeled argumentation framework for stable extensions. The criterion for this check is that the set contains only two types of labels: legal \(in\) labels and legal \(out\) labels. During the labeling transition, the algorithm first performs the \(in\) transition operation. As shown in Algorithm 3, it selects an argument \(x\) from the \(blank\) arguments that have not been labeled and labels the chosen argument \(x\) as \(in\). The arguments attacking \(x\) are labeled as \(must\_out\) (lines 10-11), and the arguments attacked by \(x\) are labeled as \(out\) (lines 13-5). After marking the arguments that have a direct attack relationship with \(x\), the algorithm checks the legality of the generated \(must\_out\) labels. If they are legal, the algorithm uses the arguments labeled as \(must\_out\) and \(out\) as two label inference directions. First, it judges whether more labels can be propagated in the \(must\_out\) direction (lines 12-16). For instance, in Figure 2, argument \(a_{4}\) propagates to argument \(a_{6}\). Then, it judges whether more labels can be propagated in the \(out\) direction (lines 13-19).