## 2 Critical Line Set and Its Search Method
### Search Method of CLS Based on Improved Shortest Path Algorithm  
The Dijkstra algorithm is a classical shortest path algorithm for solving the shortest path problem, which can solve the shortest path from one source node to multiple end nodes. In this section, the shortest path algorithm is improved. Differing from the Dijkstra algorithm, which requires repeated traversal, the improved search method ensures the search process's unidirectionality based on the adjacency matrix, reducing the search process's complexity. The improved shortest path method is described in detail below. The improved shortest path algorithm can search the shortest path from the source node to the end and discover all the first K shortest paths that satisfy Equation (4). The K shortest paths include all branches that satisfy Equation (1), and all branches on these paths constitute the CLS. According to the definition of the CLS and its graph theory characteristics, searching the CLS is equivalent to searching the multiple connected paths between the two ends of the removed branch; that is, searching the first \(K\) shortest paths that can form the loop with the removed branch. The principle of selecting the value of \(K\) in this paper is as shown in Equation (4). \[K{=}\max\{i|Z_{i}\leq\varepsilon Z_{\min}\,\} \tag{4}\]  
where \(Z_{i}\) is the length of the \(i\)th shortest path between two ends; \(Z_{\min}\) is the minimum length of all the shortest paths between two ends; \(\varepsilon\) is the threshold value of the path length ratio. The selection principle of the value of \(\varepsilon\) is as follows: since the larger the value of \(d_{0}\) is, the smaller the value of \(\varepsilon\) is, it is approximately considered that \(\varepsilon\) is inversely proportional to \(d_{0}\). In order to improve the adaptability of the method proposed in this paper to various types of power grids, \(d_{0}\) takes the defined median value of 0.25, so take \(\varepsilon=1/d_{0}-1=3\); subtracting 1 is an adjustment to the less than equal sign in Equation (4) [20]. This value is taken to ensure that even in the extreme case, that is, the \(K+1\)th shortest path has no intersection with the \(K\)th shortest path, and the APCV due to LE on all branches of the \(K\)th shortest path is less than 1/4 of the active power of the removed branch (because a small part of the power encroaches on the branch outside the CLS). Therefore, the first to the last shortest path contains all branches with \(d>d_{0}\). The BCD of all nodes in the path is two except for the source and final nodes, whose BCD is one. The nodes in the path with a BCD of two are defined as inner nodes, and their  
Figure 2: Subgraphs and LE regions. number is denoted by \(N\). A large number of simulations have found that when \(N\) exceeds a certain value, it can be considered that this path is invalid due to the corresponding electrical distance being too long. For medium-sized systems, when \(N>10\), the branch is less affected by LE and can be ignored. The simulation case in this paper can verify. Therefore, the constraint condition of \(N\leq 10\) is added to the shortest path search. The value of \(N\) can be adjusted according to the different sizes of the system; the larger the system size, the larger \(N\), and vice versa, the smaller. Since the search for the shortest path is limited by \(\varepsilon\) and \(N\) simultaneously, the search speed is not affected by the system size. Denote the \(l\)th shortest path from the source node to the end node by \(P_{l}\), where the source node is denoted by \(v_{s}\), the end node is denoted by \(v_{t}\), and the path length is denoted by \(Z(P_{l})\). A data table, denoted by \(Paths\), is constructed to store the information of the first \(K\) shortest paths during the search process. \(Paths\) contains five fields, which are:  
1. The current search node number, denoted by \(Num\). 2. The set of nodes that have been searched, denoted by \(Q\). 3. The edge length between two nodes, denoted by \(w_{ij}\). 4.