## 2 Critical Line Set and Its Search Method
### Search Method of CLS Based on Improved Shortest Path Algorithm
The number of inner nodes, denoted by \(N\). 5. The length of the path, denoted by \(W\). During the search process, the current search node is determined based on the previous search node, and the current search node is not in the set of nodes that have been searched to ensure the search process's unidirectionality, improving the search speed. The improved algorithm consists of the following two parts:  
1. Find the shortest path 1. Obtain the topology information of the power grid, including the number of each node and branch and the reactance of each branch, then establish the adjacency matrix \(A\) based on the topology information. 2. Initialize \(Paths\) to be empty; make \(Q\) an empty set and store \(v_{s}\) as the initial record into \(Paths\); then, the field information of \(Paths\) becomes [\(v_{s}\), Null, 0, 0, 0]. 3. Find the last field information recorded by \(Paths\) and use its first field information as the current search node, denoted by \(v_{i}\). Then, search all the adjacency nodes of \(v_{i}\) based on \(A\). The adjacency nodes are denoted by \(v_{j}\), and \(v_{j}\) is not in the \(Q\) of \(v_{i}\). After getting \(v_{j}\), update \(Paths\) and replace its first field from \(v_{i}\) to \(v_{j}\); that is, \(Num=v_{j}\), and \(v_{i}\) is written into \(Q\), then \(w_{\bar{\eta}}\) is recorded in the third field, and \(N++\), \(W=W+w\). 4. If \(v_{j}=v_{t}\), the first path from \(v_{s}\) to \(v_{t}\) can be obtained according to the record in \(Q\), denoted as \(P_{1}\). Since the path with the least number of nodes is generally the first to be found, it is called the path with the fewest number of nodes here, and \(P_{1}\) will be taken as the shortest path first, denoted as \(P_{\min}\); if \(v_{j}\
eq v_{t}\), then determines whether it satisfies \(N\leq 10\). If not, then stop searching for the next adjacency node of \(v_{j}\). If it satisfies, then repeat step (3); if all the paths do not satisfy \(N\leq 10\), then the paths are considered unsolvable. 2. Backtrack to find the \(K\) shortest paths. Construct a data table, denoted as \(Pathsback\). Pathsback has the same structure as \(Paths\), and all the paths eventually obtained will be recorded in \(Pathsback\): (5) Get the length of \(P_{\min}\) found earlier, denoted as \(W_{1}\), make \(Z_{\min}=W_{1}\), and initialize \(Pathsback\) to be empty. (6) Initialize \(Paths\) to be empty and write \(v_{t}\) as the first field information of the initial record to \(Paths\); then, the field information of \(Paths\) becomes [\(v_{t}\), Null, 0, 0, 0]. (7) Find alternative paths by backtracking from \(v_{t}\) to \(v_{s}\); the paths are denoted as \(P_{l}\), and repeat the following steps until no node satisfies the condition. 1. Find out the field information of the last record in \(Paths\), and then find the node recorded in the first field, denoted as \(v_{i}\). If the fourth field of the record satisfies \(N\leq 10\), search all the adjacent nodes of \(v_{i}\), denoted as \(v_{j}\), and \(v_{j}\) is not in the \(Q\) of \(v_{i}\). If \(Z(P_{i})>\epsilon Z_{\text{min}}\), the subsequent nodes of \(v_{j}\) are no longer searched. If \(N>10\), the search for adjacent nodes of \(v_{i}\) is stopped. 2. If \(v_{j}=v_{\text{s}}\), store the information of this node into _Paths_ and record \(N\) as infinity when storing; that is, no longer search for this path. Compare the length of this path with the size of \(Z_{\text{min}}\): if \(Z(P_{i})<Z_{\text{min}}\), then make \(Z_{\text{min}}=Z(P_{i})\); if \(Z(P_{i})>\epsilon Z_{\text{min}}\), then \(P_{i}\) is an invalid path; if \(Z(P_{i})\leq\epsilon Z_{\text{min}}\), then \(P_{i}\) is temporarily considered to be a valid path and the information related to this node is stored in _Pathsback_. If \(v_{j}\
eq v_{\text{s}}\), the information of \(v_{j}\) is added into _Paths_, that is, \(Num=v_{j}\), \(Q=Q\cup v_{i}\), \(w=w_{\bar{y}}\), \(N++\), \(W=W+w\). 3. Repeat step (7). Finally, _Pathsback_ records the current \(K\) valid path information. 4.