# An Improved Breadth-First Search Method Based on Information Interaction Applied for Power Network Topology Analysis

Authors: Haihong Bian; Zhengyang Guo; Ximeng Wang; Chengang Zhou; Shengwei Bing; Zhiyuan Zhang
Journal: Mathematical Problems in Engineering
 (2023)

---

## Abstract

With the rapid development of new energy resources and diversified load, power network topology data have grown swiftly. To meet the needs of the smart grid dispatching system, the power network topology analysis to support the marketing, power distribution, and other businesses in the operation of the grid has become one of the bottlenecks in the development of the smart grid. In the power grid, the outgoing lines of some generators are directly connected to the transformer, and during the busbar analysis, the nodes only adjacent to the transformer components will be identified as independent busbars. Therefore, a new method of node numbering optimization is proposed, in which the nodes adjacent to the switch are numbered preferentially. On this basis, a new abstract description method of adjacency relations and an improved breadth-first search method based on information interaction are proposed. Finally, simulation experiments are carried out in power grids with three different scales. The simulation results show that the algorithm can quickly and accurately realize power network topology analysis in the large-scale power grid, and the operating efficiency is improved by about 20% compared with the traditional algorithm.


---

## Body

## 1. Introduction

The power network topology analysis is based on the real-time data of the power system. The real-time topology of the entire network is obtained by refining the information on switches, busbars, transformers, generators, and loads in the power system. In recent years, the power grid architecture and operation mode have become more and more complex. The in-depth study on the topology analysis algorithm oriented to the physical node information of large-scale and large-capacity power grids can provide the initial network data structure and stability guarantee to the online state estimation of large-scale power grids [1–3], power flow calculation optimization [4, 5], power system safety analysis [6, 7], and relay protection device coordination [8].The essence of power network topology analysis is the problem of network connectivity. The most common methods are the search method, matrix method, and related algorithms combined with new technologies. The matrix method has the advantages of intuitive calculation and simple programming in practical applications. Zhang et al. [9] realized the power network topology analysis based on the adjacency matrix method. However, under the background of the continuous expansion of the power grid, the adjacency matrix established by the traditional matrix method not only occupies a large amount of memory but also cannot meet the real-time and accuracy requirements of the power dispatching system. Yao [10] used the matrix quasi-square method to optimize the times of matrix self-multiplication to improve the operation efficiency of the algorithm. Yao et al. [11] used sparse technology to simplify matrix storage, optimize the traditional matrix method, and achieve significant acceleration. Compared with the matrix method, the search method does not need to perform large-scale matrix self-multiplication calculations, which saves memory resources. The disadvantage is that the adaptability to the loop network and mesh network is poor and the algorithm is relatively complex. Hua et al. [12] proposed a depth-first search method with good scalability and compatibility. This method adopts the idea of “first in, last out,” and there is a step of backtracking nodes in the search process, which leads to repeated visits of nodes, thus reducing the efficiency of the algorithm. Bose and Clements [13] realized the real-time modeling of the power network based on the breadth-first search algorithm, which traversed all the nodes adjacent to the root node according to the idea of “first in, first out” and put them in the queue in turn. During the search process, there is no need to backtrack the nodes, which reduces the repeated visits of the nodes, thereby improving efficiency. In addition, some scholars explored new technologies for power network topology analysis from the perspective of the power grid structure and component states. Cheng et al. [14] proposed a switch classification method, which determined the network topology of the power system through different switch types, realized the coordination of plant-station topology analysis and system topology analysis, and improved the efficiency of topology analysis from the grid level.Some physical nodes are not adjacent to the switch depending on the structure of the grid; this part of the nodes can be regarded as independent busbars during busbar analysis. Therefore, if numbering the nodes adjacent to the switch preferentially, the independent busbar can be filtered out in advance, thereby reducing the search dimension. The node labeling method [15] can be used to mark the searched node in the process of topology analysis, so as to inform the computer that the node has formed a complete connectivity relationship with other nodes, which avoids unnecessary breadth-first traversal of the adjacent nodes of the node by the computer and further reduces the time cost. However, the traditional method requires that the array describing the adjacency relationship of each node should cover all its adjacent nodes, which leads to the following unavoidable situation. Assuming that node i is adjacent to node j, and i < j, nodes Bij adjacent to i are also adjacent to j. Since Bij has formed a connectivity relationship with i, when searching for nodes adjacent to j, the computer will still judge whether Bij is connective, which is obviously meaningless. It will undoubtedly cause high time overhead when the scale of the power grid is large.In general, the previous research on network topology analysis related to the search method mainly focused on the improvement of the algorithm itself. However, the node numbering optimization method considering the characteristics of the power grid structure and the form of array used to describe the adjacency relationship between nodes has received little attention. For the busbar analysis process, considering the real power grid structure, this paper proposes a new node numbering optimization method, in which the nodes adjacent to the switch are numbered preferentially. In addition, this paper defines a new adjacency relationship description method. Only some adjacent nodes whose node number is greater than their own node number are reserved for each node. However, due to the lack of adjacency information, the connectivity relationship formed after each breadth-first search is no longer complete in most cases. To this end, this paper presents an improved breadth-first search method based on information interaction applied for power network topology analysis, which marks the array describing the adjacency relationship by the node labeling method, so that the busbar (or topological island) whose connectivity relationship between nodes has been determined by breadth-first search and the busbar (or topological island) that is undergoing breadth-first search generate information interaction. If it is determined that there is a potential connectivity relationship between these two, they will be merged into a new busbar (or topological island), so as to realize the rapid traversal of the entire power network topology and further reduce the meaningless time overhead. Finally, the running speed of the method proposed in this paper and the traditional method are compared under the examples of three different scales to verify the effectiveness.The paper is organized as follows: Section2 takes the 17 node power system as an example to analyze the numbering logic of different node numbering optimization technologies. Section 3 introduces the basic steps of the traditional power network topology analysis method based on the breadth-first algorithm, and further analyzes the advantages of the node numbering optimization technology proposed in this paper through examples. In Section 4, an improved abstract description method of adjacency relation is proposed. On this basis, the idea of information interaction is introduced and an improved breadth-first search method is designed. In Section 5, the acceleration effect of the proposed method in large-scale scenes is verified by experiments. Section 6 gives a summary and discusses some ideas for future work.


## 2. Node Numbering Optimization Technology

The power network topology needs to know the connectivity relationship between nodes, and the number of outgoing lines, connection elements, and switch states of each node are different. Therefore, the order of node numbering optimization will affect the efficiency of power network topology analysis to a certain extent.


### 2.1. Node Sequence Numbering

As shown in Figure1, in the actual raw data of the power system, physical nodes are not numbered in a certain order but are marked with strings, such as 100122321 or A123BC001. Such nodes marked with strings cannot be directly used for power network topology analysis, so the initial physical nodes need to be renumbered one by one. Node numbering optimization technology can provide conditions for topology analysis without changing the original power network topology. The node sequence numbering has the characteristics of a simple structure but is relatively unscientific at the same time. This method is used to number the nodes in Figure 1, and the results are shown in Table 1.Figure 1
17 node power system.Table 1
Numbering the nodes in order of node sequence.
Initial node numberNode number resultA100101A100112A100123A100134A100145A100156A100167A100178A100189A1001910A1002011A1002112A1002213A1002314A1002415A1002516A1002617


### 2.2. Numbering the Nodes According to the Number of Outgoing Lines from More to Less

Since the topology analysis based on the breadth-first search method will traverse the nodes of the whole graph in turn, before the first search or after each time the complete connectivity relationship between some nodes is determined, it is possible to have an adjacency with more nodes if the first unlabeled nodek has more outgoing lines, thereby reducing the number of times of judging whether a node has been merged in this search, it can slightly improve the average operating efficiency generally. The nodes in Figure 1 are numbered using this method, and the results are shown in Table 2.Table 2
Numbering the nodes according to the number of outgoing lines from more to less.
Initial node numberNumber of outgoing linesNode number resultA10010113A1001126A1001227A1001331A1001432A1001533A1001634A1001728A1001829A10019114A10020115A10021210A1002235A10023211A10024212A10025116A10026117


### 2.3. Numbering the Nodes Adjacent to the Switch Preferentially

According to the grid structure, the outlet node of some generators will be directly connected to the transformer, and there will be no switching elements installed in the middle, such as A10020 and A10025 in Figure1. The transformer component is treated as an open circuit component when performing busbar analysis. Obviously, A10020 and A10025 are independent busbars. Selecting such nodes prior to busbar analysis can help reduce the search range and improve the operating efficiency of busbar analysis to a certain extent. Therefore, a node numbering optimization method is proposed in which the nodes adjacent to the switch are numbered preferentially. The nodes adjacent to the switch are sorted from more to less according to the number of adjacent switch components. This is because whether there is an adjacency relationship between two nodes mainly depends on the on-off condition of the switching components in the busbar analysis. If only the number of outgoing lines of the node is considered, the probability of the number of adjacent nodes of the node with the former number being less than that of the adjacent nodes with the later number will increase. For example, both A10013 and A10014 in Figure 1 have 3 outgoing lines, but during busbar analysis, A10013 actually only has an adjacency relationship with A10012. If A10013 is renumbered first, it will increase the number of judgments on whether some nodes have been merged. Generally speaking, the average search efficiency will be slightly lower than the case of preferentially renumbering A10014, which will be given in a more detailed explanation below. When using the node numbering optimization method proposed in this paper, since A10013 is only adjacent to two switching elements, A10014 will be numbered preferentially. It should be noted that, since the transformer element will be regarded as a closed switch during the topological island analysis, and the object of the topological island analysis is the busbars of entire power network, this node numbering optimization method is only applicable to the busbar analysis.Using this method, the nodes in Figure1 are numbered, and the numbering results are shown in Table 3.Table 3
Numbering the nodes adjacent to the switch preferentially.
Nodes connected to switchNumber of adjacent switching elementsNode number resultNodes not connected to switchNode number resultA1001019A1002016A10011110A1002517A1001222A1001323A1001431A1001524A1001625A1001726A10018111A10019112A1002127A1002228A10023113A10024114A10026115


## 2.1. Node Sequence Numbering

As shown in Figure1, in the actual raw data of the power system, physical nodes are not numbered in a certain order but are marked with strings, such as 100122321 or A123BC001. Such nodes marked with strings cannot be directly used for power network topology analysis, so the initial physical nodes need to be renumbered one by one. Node numbering optimization technology can provide conditions for topology analysis without changing the original power network topology. The node sequence numbering has the characteristics of a simple structure but is relatively unscientific at the same time. This method is used to number the nodes in Figure 1, and the results are shown in Table 1.Figure 1
17 node power system.Table 1
Numbering the nodes in order of node sequence.
Initial node numberNode number resultA100101A100112A100123A100134A100145A100156A100167A100178A100189A1001910A1002011A1002112A1002213A1002314A1002415A1002516A1002617


## 2.2. Numbering the Nodes According to the Number of Outgoing Lines from More to Less

Since the topology analysis based on the breadth-first search method will traverse the nodes of the whole graph in turn, before the first search or after each time the complete connectivity relationship between some nodes is determined, it is possible to have an adjacency with more nodes if the first unlabeled nodek has more outgoing lines, thereby reducing the number of times of judging whether a node has been merged in this search, it can slightly improve the average operating efficiency generally. The nodes in Figure 1 are numbered using this method, and the results are shown in Table 2.Table 2
Numbering the nodes according to the number of outgoing lines from more to less.
Initial node numberNumber of outgoing linesNode number resultA10010113A1001126A1001227A1001331A1001432A1001533A1001634A1001728A1001829A10019114A10020115A10021210A1002235A10023211A10024212A10025116A10026117


## 2.3. Numbering the Nodes Adjacent to the Switch Preferentially

According to the grid structure, the outlet node of some generators will be directly connected to the transformer, and there will be no switching elements installed in the middle, such as A10020 and A10025 in Figure1. The transformer component is treated as an open circuit component when performing busbar analysis. Obviously, A10020 and A10025 are independent busbars. Selecting such nodes prior to busbar analysis can help reduce the search range and improve the operating efficiency of busbar analysis to a certain extent. Therefore, a node numbering optimization method is proposed in which the nodes adjacent to the switch are numbered preferentially. The nodes adjacent to the switch are sorted from more to less according to the number of adjacent switch components. This is because whether there is an adjacency relationship between two nodes mainly depends on the on-off condition of the switching components in the busbar analysis. If only the number of outgoing lines of the node is considered, the probability of the number of adjacent nodes of the node with the former number being less than that of the adjacent nodes with the later number will increase. For example, both A10013 and A10014 in Figure 1 have 3 outgoing lines, but during busbar analysis, A10013 actually only has an adjacency relationship with A10012. If A10013 is renumbered first, it will increase the number of judgments on whether some nodes have been merged. Generally speaking, the average search efficiency will be slightly lower than the case of preferentially renumbering A10014, which will be given in a more detailed explanation below. When using the node numbering optimization method proposed in this paper, since A10013 is only adjacent to two switching elements, A10014 will be numbered preferentially. It should be noted that, since the transformer element will be regarded as a closed switch during the topological island analysis, and the object of the topological island analysis is the busbars of entire power network, this node numbering optimization method is only applicable to the busbar analysis.Using this method, the nodes in Figure1 are numbered, and the numbering results are shown in Table 3.Table 3
Numbering the nodes adjacent to the switch preferentially.
Nodes connected to switchNumber of adjacent switching elementsNode number resultNodes not connected to switchNode number resultA1001019A1002016A10011110A1002517A1001222A1001323A1001431A1001524A1001625A1001726A10018111A10019112A1002127A1002228A10023113A10024114A10026115


## 3. Traditional Power Network Topology Analysis Method Based on the Breadth-First Search Method

The adjacency matrix method and its deformation algorithm are more suitable for the power network topology analysis with nodes of small scale. When the node scale is large, the shortcomings of low timeliness, long time consumption, and large memory footprint will be exposed [16]. Compared with the adjacent matrix method, the expansion of node size has a lower impact on the efficiency of the search method, and the demand for system memory is much smaller. Therefore, the search method has unique advantages in the face of large-scale power network topology analysis problems. The main purpose of power network topology analysis is to convert the physical model represented by nodes into a mathematical model represented by busbars. First, a busbar analysis is performed to merge many physical nodes connected by closed switches to form multiple busbars. Then, the topological island analysis is carried out, and the transformer between each busbar is regarded as a closed switch, and many busbars connected by closed branches are merged to obtain the topological structure of the entire power grid.


### 3.1. The Traditional Abstract Description Method of Adjacency Relationship

The nodes in Figure1 are numbered according to the principle of numbering the nodes adjacent to the switch preferentially, and a schematic diagram of the adjacency relationship between each node is obtained, as shown in Figure 2. Obviously, 16 and 17 were identified as independent busbars before the busbar analysis. In order to facilitate the topology analysis based on the search method, it is necessary to abstractly describe the adjacency relationship between each node. For traditional topology analysis methods, the adjacency information of any node is completely described. The first column of the array stores the nodes’ numbers in ascending order, and the nodes that have an adjacent relationship with each node will be inserted into the specified position in turn after each node. The adjacency relationship between nodes in Figure 2 can be abstractly described by the array shown in Figure 3.Figure 2
Schematic diagram of adjacency between nodes.Figure 3
Using arrays to describe the adjacency in Figure2 abstractly.


### 3.2. Traditional Power Network Topology Analysis Method Based on the Breadth-First Search Method

Search methods are generally divided into the depth-first algorithm and breadth-first algorithm. In terms of operation efficiency, the breadth-first search method is more suitable for topology analysis than the depth-first search algorithm [17]. The breadth-first search method is similar to the hierarchical traversal process of a tree [18]. In the initial state, all nodes have not been visited yet, and the entire graph is traversed from node 1, as shown in Figure 4 (a). Starting from node 1, adjacent nodes 2, 3, and 4 that have not been visited can be searched in turn, as shown in Figure 4 (b). Next, the adjacent nodes of the second layer node are searched in turn. Obviously, 5, 6, 7, 8, 9, and 10 all meet the requirement of not being visited yet, as shown in Figure 4 (c). When searching the adjacent nodes of the third-layer node, it is found that all nodes have been visited. So far, a complete round of breadth-first search method ends.Figure 4
Breadth-first search.The steps of the traditional power network topology analysis method based on the breadth-first search method are as follows:(1)
Traverse the arrayV that abstractly describes the adjacency relationship from top to bottom,i represents the row index of V, set i = 0. After that, go to (2);(2)
IfV[i][0] is not marked, create an array q to store connected nodes, and set q = V[i]. jump is the index of the node in q, and the initial value of jump is set to 1. len represents the number of nodes in q, which also changes dynamically when q is updated. After that, go to (3). If V[i][0] is marked, set i = i + 1, and go to (6);(3)
Ifjump < len, go to (4). If jump = len, go to (5);(4)
MarkV[q[jump] − 1][0]. If the number of nodes in V[q[jump] − 1] is greater than 2, it means that it may contain additional nodes that can form a connectivity relationship with the nodes in q. Therefore, judge whether the nodes after V[q[jump] − 1][0] exist in q in turn, and insert the nodes not included in q into the end of q in turn. Finally, set jump = jump + 1, go to (3). If the number of nodes in V[q[jump] − 1] is equal to 2, set jump = jump + 1, go to (3);(5)
The nodes inq have formed a completely connectivity relationship, and q is stored in Q. After that, set i = i + 1, go to (6);(6)
Ifi exceeds the index range, the topology analysis is complete, and exit the loop. Otherwise, go to (2).The pseudocode of the algorithm is shown in Algorithm1.Algorithm 1: Pseudocode of traditional topology analysis method. Algorithm name: Algorithm_A.
(1)
m = V.size()(2)
for (i = 0; i < m; i ++) do(3)
ifV[i][0] = = i + 1 then(4)
q = V[i];(5)
jump = 1;(6)
whilejump < lendo(7)
V[q[jump] − 1][0] = q[0];(8)
ifV[q[jump] − 1].size() > 2 then(9)
for (j = 1; j < V[q[jump] − 1].size(); j ++) do(10)
ifV[q[jump] − 1][j] not in qthen(11)
q.push_back (V[q[jump] − 1][j]);(12)
end if;(13)
end for;(14)
end if;(15)
jump++;(16)
end while;(17)
Q.push_back(q);(18)
else(19)
continue;(20)
end if;(21)
end for;Taking arrayV in Figure 3 as an example, use the above method for busbar analysis. First, there is V[0][0] = 1, node 1 is not marked, so set q = {1, 2, 5, 7} and jump = 1. Obviously, there is jump < len, so mark V[1][0], the set of adjacent nodes of 2 is n2 = {1, 3}, then update q to {1, 2, 5, 7, 3}, and set jump = 2. There is still jump < len, so mark V[4][0], the set of adjacent nodes of 5 is n5 = {1, 6}, then update q to {1, 2, 5, 7, 3, 6}, and set jump = 3. There is still jump < len, so mark V[6][0], the set of adjacent nodes of 7 is n7 = {1, 8}, update q to {1, 2, 5, 7, 3, 6, 8}, and set jump = 4. There is still jump < len, so mark V[2][0] and set jump = 5. There is still jump < len, so mark V[5][0], the set of adjacent nodes of 6 is n6 = {4, 5}, then update q to {1, 2, 5, 7, 3, 6, 8, 4}, and set jump = 6. There is still jump < len, so mark V[7][0] and set jump = 7. There is still jump < len, so mark V[3][0] and set jump = 8. At this time, there is jump = len, and the nodes in q have formed a complete connectivity relationship, so store q in Q and seti = 1. V[1][0] is already marked, so set i = 2. V[2][0] is already marked, so set i = 3. V[3][0] is already marked, so set i = 4. V[4][0] is already marked, so set i = 5. V[5][0] is already marked, so set i = 6. V[6][0] is already marked, so set i = 7. V[7][0] is already marked, so set i = 8. There is V[8][0] = 9, node 9 is not marked, so set q = {9, 10} and jump = 1. Obviously, there is jump < len, so mark V[9][0] and set jump = 2. At this time, there is jump = len, so store q in Q and set i = 9. V[9][0] is already marked, so set i = 10. There is V[10][0] = 11, node 11 is not marked, so set q = {11, 12} and jump = 1. Obviously, there is jump < len, so mark V[11][0] and set jump = 2. At this time, there is jump = len, so store q in Q and set i = 11. V[11][0] has been marked, so set i = 12. There is V[12][0] = 13, node 13 is not marked, so set q = {13} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 13. There is V[13][0] = 14, node 14 is not marked, so set q = {14} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 14. There is V[14][0] = 15, node 15 is not marked, so set q = {15} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 15. i exceeds the index range, the busbar analysis is complete, and exit the loop.After the busbar analysis is completed, each busbar is regarded as a topology node. It should be noted that 16 and 17 should also be taken into account when performing topological island analysis, and all topology nodes should be renumbered according to the principle of the number of outgoing lines from more to less. The numbering results are shown in Figure5. Then, using the breadth-first topology analysis method, all the busbars with electrical connections are merged into topological islands. Finally, the topological island analysis is completed. The research objects of busbar analysis and topological island analysis are different, but the steps are the same. Therefore, the process of topological island analysis will not be repeated here.Figure 5
Topology node renumbering results.When the nodes are numbered according to the principle that the nodes adjacent to the switch are numbered preferentially, if the nodes adjacent to the switch are numbered according to the principle of the number of outgoing lines of nodes from more to less, for the power grid Structure in Figure1, the adjacency relationship between the nodes is shown in Figure 6 and can be abstractly described by the array shown in Figure 7.Figure 6
Schematic diagram of adjacency between nodes.Figure 7
Using arrays to describe the adjacency in Figure6 abstractly.Taking arrayV in Figure 7 as an example, the busbar analysis is performed using the breadth-first search method. First, there is V[0][0] = 1, node 1 is not marked, so set q = {1, 7} and jump = 1. Obviously, there is jump < len, so mark V[6][0], the set of adjacent nodes of 7 is n7 = {1, 2}, then update q to {1, 7, 2}, and set jump = 2. There is still jump < len, so mark V[1][0], the set of adjacent nodes of 2 is n2 = {4, 7, 10}, then update q to {1, 7, 2, 4, 10}, and set jump = 3. There is still jump < len, so mark V[3][0], the set of adjacent nodes of 4 is n4 = {2, 8}, then update q to {1, 7, 2, 4, 10, 8}, and set jump = 4. There is still jump < len, so mark V[9][0], the set of adjacent nodes of 10 is n10 = {2, 5}, then update q to {1, 7, 2, 4, 10, 8, 5}, and set jump = 5. There is still jump < len, so mark V[7][0], the set of adjacent nodes of 8 is n8 = {3, 4}, then update q to {1, 7, 2, 4, 10, 8, 5, 3}, and set jump = 6. There is still jump < len, so mark V[4][0] and set jump = 7. There is still jump < len, so mark V[2][0] and set jump = 8. At this time, there is jump = len, and the nodes in q have formed a complete connectivity relationship, so store q in Q and set i = 1. V[1][0] is already marked, so set i = 2. V[2][0] is already marked, so set i = 3. V[3][0] is already marked, so set i = 4. V[4][0] is already marked, so set i = 5. There is V[5][0] = 6, node 6 is not marked, so set q = {6, 13} and jump = 1. Obviously, there is jump < len, so mark V[12][0] and set jump = 2. At this time, there is jump = len, so store q in Q and set i = 6. V[6][0] is already marked, so set i = 7. V[7][0] is already marked, so set i = 8. There is V[8][0] = 9, node 9 is not marked, so set q = {9, 14}, and jump = 1. Obviously, there is jump < len, so mark V[13][0] and set jump = 2. At this time, there is jump = len, so store q in Q and set i = 9. V[9][0] is already marked, so set i = 10. There is V[10][0] = 11, node 11 is not marked, so set q = {11} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 11. There is V[11][0] = 12, node 12 is not marked, so set q = {12} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 12. V[12][0] is already marked, so set i = 13. V[13][0] is already marked, so set i = 14. There is V[14][0] = 15, node 15 is not marked, so set q = {15} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 15. i exceeds the index range, the busbar analysis is complete, and exit the loop.Compared with the busbar analysis process of the array describing the adjacency relationship in Figure3, the main difference is that the number of times judging whether the nodes in the adjacent node set ni exist in q is significantly increased. Therefore, when numbering the nodes by using the method of numbering the nodes adjacent to the switch preferentially, for the nodes adjacent to the switch, if they are numbered from more to less according to the number of adjacent switches, the average operating efficiency will generally be better than that are numbered from more to less according to the number of outgoing lines of nodes. Compared to node sequence numbering, this is also the reason why the topology nodes are numbered according to the number of outgoing lines of the nodes from more to less when analyzing topological islands.


## 3.1. The Traditional Abstract Description Method of Adjacency Relationship

The nodes in Figure1 are numbered according to the principle of numbering the nodes adjacent to the switch preferentially, and a schematic diagram of the adjacency relationship between each node is obtained, as shown in Figure 2. Obviously, 16 and 17 were identified as independent busbars before the busbar analysis. In order to facilitate the topology analysis based on the search method, it is necessary to abstractly describe the adjacency relationship between each node. For traditional topology analysis methods, the adjacency information of any node is completely described. The first column of the array stores the nodes’ numbers in ascending order, and the nodes that have an adjacent relationship with each node will be inserted into the specified position in turn after each node. The adjacency relationship between nodes in Figure 2 can be abstractly described by the array shown in Figure 3.Figure 2
Schematic diagram of adjacency between nodes.Figure 3
Using arrays to describe the adjacency in Figure2 abstractly.


## 3.2. Traditional Power Network Topology Analysis Method Based on the Breadth-First Search Method

Search methods are generally divided into the depth-first algorithm and breadth-first algorithm. In terms of operation efficiency, the breadth-first search method is more suitable for topology analysis than the depth-first search algorithm [17]. The breadth-first search method is similar to the hierarchical traversal process of a tree [18]. In the initial state, all nodes have not been visited yet, and the entire graph is traversed from node 1, as shown in Figure 4 (a). Starting from node 1, adjacent nodes 2, 3, and 4 that have not been visited can be searched in turn, as shown in Figure 4 (b). Next, the adjacent nodes of the second layer node are searched in turn. Obviously, 5, 6, 7, 8, 9, and 10 all meet the requirement of not being visited yet, as shown in Figure 4 (c). When searching the adjacent nodes of the third-layer node, it is found that all nodes have been visited. So far, a complete round of breadth-first search method ends.Figure 4
Breadth-first search.The steps of the traditional power network topology analysis method based on the breadth-first search method are as follows:(1)
Traverse the arrayV that abstractly describes the adjacency relationship from top to bottom,i represents the row index of V, set i = 0. After that, go to (2);(2)
IfV[i][0] is not marked, create an array q to store connected nodes, and set q = V[i]. jump is the index of the node in q, and the initial value of jump is set to 1. len represents the number of nodes in q, which also changes dynamically when q is updated. After that, go to (3). If V[i][0] is marked, set i = i + 1, and go to (6);(3)
Ifjump < len, go to (4). If jump = len, go to (5);(4)
MarkV[q[jump] − 1][0]. If the number of nodes in V[q[jump] − 1] is greater than 2, it means that it may contain additional nodes that can form a connectivity relationship with the nodes in q. Therefore, judge whether the nodes after V[q[jump] − 1][0] exist in q in turn, and insert the nodes not included in q into the end of q in turn. Finally, set jump = jump + 1, go to (3). If the number of nodes in V[q[jump] − 1] is equal to 2, set jump = jump + 1, go to (3);(5)
The nodes inq have formed a completely connectivity relationship, and q is stored in Q. After that, set i = i + 1, go to (6);(6)
Ifi exceeds the index range, the topology analysis is complete, and exit the loop. Otherwise, go to (2).The pseudocode of the algorithm is shown in Algorithm1.Algorithm 1: Pseudocode of traditional topology analysis method. Algorithm name: Algorithm_A.
(1)
m = V.size()(2)
for (i = 0; i < m; i ++) do(3)
ifV[i][0] = = i + 1 then(4)
q = V[i];(5)
jump = 1;(6)
whilejump < lendo(7)
V[q[jump] − 1][0] = q[0];(8)
ifV[q[jump] − 1].size() > 2 then(9)
for (j = 1; j < V[q[jump] − 1].size(); j ++) do(10)
ifV[q[jump] − 1][j] not in qthen(11)
q.push_back (V[q[jump] − 1][j]);(12)
end if;(13)
end for;(14)
end if;(15)
jump++;(16)
end while;(17)
Q.push_back(q);(18)
else(19)
continue;(20)
end if;(21)
end for;Taking arrayV in Figure 3 as an example, use the above method for busbar analysis. First, there is V[0][0] = 1, node 1 is not marked, so set q = {1, 2, 5, 7} and jump = 1. Obviously, there is jump < len, so mark V[1][0], the set of adjacent nodes of 2 is n2 = {1, 3}, then update q to {1, 2, 5, 7, 3}, and set jump = 2. There is still jump < len, so mark V[4][0], the set of adjacent nodes of 5 is n5 = {1, 6}, then update q to {1, 2, 5, 7, 3, 6}, and set jump = 3. There is still jump < len, so mark V[6][0], the set of adjacent nodes of 7 is n7 = {1, 8}, update q to {1, 2, 5, 7, 3, 6, 8}, and set jump = 4. There is still jump < len, so mark V[2][0] and set jump = 5. There is still jump < len, so mark V[5][0], the set of adjacent nodes of 6 is n6 = {4, 5}, then update q to {1, 2, 5, 7, 3, 6, 8, 4}, and set jump = 6. There is still jump < len, so mark V[7][0] and set jump = 7. There is still jump < len, so mark V[3][0] and set jump = 8. At this time, there is jump = len, and the nodes in q have formed a complete connectivity relationship, so store q in Q and seti = 1. V[1][0] is already marked, so set i = 2. V[2][0] is already marked, so set i = 3. V[3][0] is already marked, so set i = 4. V[4][0] is already marked, so set i = 5. V[5][0] is already marked, so set i = 6. V[6][0] is already marked, so set i = 7. V[7][0] is already marked, so set i = 8. There is V[8][0] = 9, node 9 is not marked, so set q = {9, 10} and jump = 1. Obviously, there is jump < len, so mark V[9][0] and set jump = 2. At this time, there is jump = len, so store q in Q and set i = 9. V[9][0] is already marked, so set i = 10. There is V[10][0] = 11, node 11 is not marked, so set q = {11, 12} and jump = 1. Obviously, there is jump < len, so mark V[11][0] and set jump = 2. At this time, there is jump = len, so store q in Q and set i = 11. V[11][0] has been marked, so set i = 12. There is V[12][0] = 13, node 13 is not marked, so set q = {13} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 13. There is V[13][0] = 14, node 14 is not marked, so set q = {14} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 14. There is V[14][0] = 15, node 15 is not marked, so set q = {15} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 15. i exceeds the index range, the busbar analysis is complete, and exit the loop.After the busbar analysis is completed, each busbar is regarded as a topology node. It should be noted that 16 and 17 should also be taken into account when performing topological island analysis, and all topology nodes should be renumbered according to the principle of the number of outgoing lines from more to less. The numbering results are shown in Figure5. Then, using the breadth-first topology analysis method, all the busbars with electrical connections are merged into topological islands. Finally, the topological island analysis is completed. The research objects of busbar analysis and topological island analysis are different, but the steps are the same. Therefore, the process of topological island analysis will not be repeated here.Figure 5
Topology node renumbering results.When the nodes are numbered according to the principle that the nodes adjacent to the switch are numbered preferentially, if the nodes adjacent to the switch are numbered according to the principle of the number of outgoing lines of nodes from more to less, for the power grid Structure in Figure1, the adjacency relationship between the nodes is shown in Figure 6 and can be abstractly described by the array shown in Figure 7.Figure 6
Schematic diagram of adjacency between nodes.Figure 7
Using arrays to describe the adjacency in Figure6 abstractly.Taking arrayV in Figure 7 as an example, the busbar analysis is performed using the breadth-first search method. First, there is V[0][0] = 1, node 1 is not marked, so set q = {1, 7} and jump = 1. Obviously, there is jump < len, so mark V[6][0], the set of adjacent nodes of 7 is n7 = {1, 2}, then update q to {1, 7, 2}, and set jump = 2. There is still jump < len, so mark V[1][0], the set of adjacent nodes of 2 is n2 = {4, 7, 10}, then update q to {1, 7, 2, 4, 10}, and set jump = 3. There is still jump < len, so mark V[3][0], the set of adjacent nodes of 4 is n4 = {2, 8}, then update q to {1, 7, 2, 4, 10, 8}, and set jump = 4. There is still jump < len, so mark V[9][0], the set of adjacent nodes of 10 is n10 = {2, 5}, then update q to {1, 7, 2, 4, 10, 8, 5}, and set jump = 5. There is still jump < len, so mark V[7][0], the set of adjacent nodes of 8 is n8 = {3, 4}, then update q to {1, 7, 2, 4, 10, 8, 5, 3}, and set jump = 6. There is still jump < len, so mark V[4][0] and set jump = 7. There is still jump < len, so mark V[2][0] and set jump = 8. At this time, there is jump = len, and the nodes in q have formed a complete connectivity relationship, so store q in Q and set i = 1. V[1][0] is already marked, so set i = 2. V[2][0] is already marked, so set i = 3. V[3][0] is already marked, so set i = 4. V[4][0] is already marked, so set i = 5. There is V[5][0] = 6, node 6 is not marked, so set q = {6, 13} and jump = 1. Obviously, there is jump < len, so mark V[12][0] and set jump = 2. At this time, there is jump = len, so store q in Q and set i = 6. V[6][0] is already marked, so set i = 7. V[7][0] is already marked, so set i = 8. There is V[8][0] = 9, node 9 is not marked, so set q = {9, 14}, and jump = 1. Obviously, there is jump < len, so mark V[13][0] and set jump = 2. At this time, there is jump = len, so store q in Q and set i = 9. V[9][0] is already marked, so set i = 10. There is V[10][0] = 11, node 11 is not marked, so set q = {11} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 11. There is V[11][0] = 12, node 12 is not marked, so set q = {12} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 12. V[12][0] is already marked, so set i = 13. V[13][0] is already marked, so set i = 14. There is V[14][0] = 15, node 15 is not marked, so set q = {15} and jump = 1. Obviously, there is jump = len, so store q in Q and set i = 15. i exceeds the index range, the busbar analysis is complete, and exit the loop.Compared with the busbar analysis process of the array describing the adjacency relationship in Figure3, the main difference is that the number of times judging whether the nodes in the adjacent node set ni exist in q is significantly increased. Therefore, when numbering the nodes by using the method of numbering the nodes adjacent to the switch preferentially, for the nodes adjacent to the switch, if they are numbered from more to less according to the number of adjacent switches, the average operating efficiency will generally be better than that are numbered from more to less according to the number of outgoing lines of nodes. Compared to node sequence numbering, this is also the reason why the topology nodes are numbered according to the number of outgoing lines of the nodes from more to less when analyzing topological islands.


## 4. An Improved Breadth-First Search Method Based on Information Interaction

The traditional method uses an array to describe the complete adjacency relationship between nodes abstractly. Therefore, the complete connectivity analysis between nodes can be realized by the breadth-first search method. However, this also leads to at least one extra judgment for any pair of nodes with an adjacency relationship to identify whether a node has formed a connectivity relationship with another node. This kind of meaningless operation will bring more time overhead when the node scale expands.


### 4.1. Improved Abstract Description Method

For any node, if only the adjacent nodes whose node number is greater than itself are stored, the meaningless judgment operations mentioned above will undoubtedly be greatly reduced. When this scheme is adopted, the adjacency relationship between each node in Figure2 can be abstractly described by the array shown in Figure 8.Figure 8
Using arrays to describe the adjacency in Figure2 abstractly.However, it can be seen from Figure2 that 4 only has an adjacency relationship with 6. To obtain 4 through the traverse of the breadth-first method, 6 must be used as the medium. Since 4 < 6, 4 is not stored after V[5][0] in Figure 8. Obviously, the traditional topology analysis method is no longer applicable in the context of this abstract description method.


### 4.2. The Improved Breadth-First Search Method Based on Information Interaction

For the array that describes the adjacency relationship abstractly in Figure8, when using the traditional topology analysis method to analyze the busbar, store q = {1, 2, 5, 7, 3, 6, 8} formed in the first breadth-first search in Q[0], since V[3][0] is not marked, set q = {4, 6} and jump = 1, there is V[5][0] = 1. Through this mark, it can be found that 6 has been merged by 1. Therefore, the nodes in q should have a connectivity relationship with the node in Q[0]. Inspired by this, combined with the node labeling method, an improved breadth-first search method based on information interaction is proposed for the whole power network topology analysis. The basic steps are as follows:(1)
Traverse the arrayV that abstractly describes the adjacency relationship from top to bottom, i represents the row index of V, set i = 0. After that, go to (2);(2)
IfV[i][0] is not marked and the number of nodes in V[i] is greater than 1, create an array q to store connected nodes, and set q = V[i]. jump is the index of the node in q, and the initial value of jump is set to 1. len represents the number of nodes in q, which also changes dynamically when q is updated. After that, go to (3). If V[i][0] is not marked and the number of nodes in V[i] is equal to 1, i is not connected to any node, store i in Z and set i = i + 1, then go to (9). If V[i][0] is marked, set i = i + 1, then go to (9);(3)
Ifjump < len, go to (4). If jump = len, go to (8);(4)
Determine the relationship betweenq[jump] and V[q[jump] − 1][0]. If q[jump] = V[q[jump] − 1][0], go to (5). If q[0] > V[q[jump] − 1][0], go to (6). If q[0] < V[q[jump] − 1][0], go to (7). If q[0] = V[q[jump] − 1][0], set jump = jump + 1, then go to (3);(5)
MarkV[q[jump] − 1][0] and set V[q[jump] − 1][0] = q[0]. If the number of nodes in V[q[jump] − 1] is greater than 1, judge whether the nodes after V[q[jump] − 1][0] exist in q in turn, and insert the nodes not included at the end of q into q in turn. Finally, set jump = jump + 1, then go to (3). If the number of nodes in V[q[jump] − 1] is equal to 1, set jump = jump + 1, then go to (3);(6)
Find the row indexw in Q of the connected node set with V[q[jump] − 1][0] as the head node, set qp = Q[w]. Record the number of nodes nj in the current qp, insert all the nodes in front of q[jump] into the tail of qp in turn, and update the node’s mark to set it equal to V[q[jump] − 1][0]. After that, judge whether the node after q[jump] is already in qp in turn, if not, insert it into the tail of qp. Finally, clear Q[w], update jump, set jump = jump + nj, and update q, set q = qp, then go to (3);(7)
Find the row indexw in Q of the connected node set with V[q[jump] − 1][0] as the head node, and set qp = Q[w]. Obviously, it is impossible for all nodes in front of q[jump] to intersect with qp, but the nodes after q[jump] have the possibility of intersecting with qp. Therefore, store all nodes in front of q[jump] into Y, store q[jump] and all the nodes after it into G, and then judge whether the nodes in qp are already in G, if not, insert it into the tail of Y, and record the number of nodes inserted into the tail through nj. At the same time, update the marks of all nodes in qp to set it equal to q[0], which also leads to the possibility of q[0] = V[q[jump] − 1][0] mentioned in (4) in the later search process. Finally, clear Q[w], update jump, and set jump = Y.size() + 1, insert G into the tail of Y and set q = Y, then go to (3);(8)
Storeq in the first empty line Q[j] of Q and set i = i + 1, then go to (9);(9)
Ifi exceeds the index range, the topology analysis is complete, and exit the loop. Otherwise, go to (2).The pseudocode of the algorithm is shown in Algorithm2.Algorithm 2: Pseudocode of improved breadth-first search method based on information interaction. Algorithm name: Algorithm_B.
(1)
m = V.size();(2)
for (i = 0; i < m; i++) do(3)
ifV[i][0] = = i + 1 && V[i].size() > 1 then(4)
q = V[i];(5)
jump = 1;(6)
whilejump < lendo(7)
ifq[jump] = V[q[jump] − 1][0] then(8)
V[q[jump] − 1][0] = q[0];(9)
ifV[q[jump] − 1].size() > 1 then(10)
for (j = 1; j < V[q[jump] − 1].size(); j++) do(11)
ifV[q[jump] − 1][j] not in qthen(12)
q.push_back(V[q[jump] − 1][j]);(13)
end if;(14)
end for;(15)
end if;(16)
jump++;(17)
else ifq[0] > V[q[jump] − 1][0] then(18)
qp = Q[w];(19)
nj = qp.size();(20)
for (j = 0; j < jump; j++) do(21)
qp.push_back(q[j]);(22)
V[q[j] − 1][0] = V[q[jump] − 1][0];(23)
end for;(24)
for (j = jump + 1; j < q.size(); j++) do(25)
ifq[j] not in qpthen(26)
qp.push_back(q[j]);(27)
end if;(28)
end for;(29)
clearQ[w];(30)
jump = jump + nj;(31)
q = qp;(32)
else ifq[0] < V[q[jump] − 1][0] then(33)
qp = Q[w];(34)
nj = 0;(35)
for (j = 0; j < qp.size(); j++) do(36)
ifqp[j] not in Gthen(37)
Y.push_back(qp[j]);(38)
nj++;(39)
end if;(40)
V[qp[j] − 1][0] = q[0];(41)
end for;(42)
clearQ[w];(43)
jump = Y.size() + 1;(44)
q = [Y G];(45)
else ifq[0] = = V[q[jump] − 1][0] then(46)
jump++;(47)
end if;(48)
end while;(49)
Ts = Q.size();(50)
for (j = 0; j < Ts; j++) do(51)
ifQ[j] is empty then(52)
Q[j] = q;(53)
break;(54)
else ifQ[j] is not empty && j = = Ts − 1 then(55)
Q.push_back(q);(56)
end if;(57)
end for;(58)
else ifV[i][0] = = i + 1 && V[i].size() = = 1 then(59)
Z.push_back(i);(60)
end if;(61)
end for;In order to explain the meaning of each step in Algorithm_B more clearly, the example shown in Figure9 is designed, and the detailed derivation process, as shown below, is given.(1)
First, there isV[0][0] = 1, node 1 is not marked, so set q = {1, 8} and jump = 1. Obviously, there is jump < len, so mark V[7][0], then set V[7][0] = 1 and jump = 2. At this time, there is jump = len, so store q in Q[0], then set i = 1. The result of (1) is shown in Figure 10(a);(2)
There isV[1][0] = 2, node 2 is not marked, so set q = {2, 9, 10} and jump = 1. Obviously, there is jump < len, so mark V[8][0], then set V[8][0] = 2 and jump = 2. There is still jump < len, so mark V[9][0], then set V[9][0] = 2 and jump = 3. At this time, there is jump = len, so store q in Q[1], then set i = 2. The result of (2) is shown in Figure 10(b);(3)
There isV[2][0] = 3, node 3 is not marked, so set q = {3, 5} and jump = 1. Obviously, there is jump < len, so mark V[4][0] and set V[4][0] = 3, the set of adjacent nodes of 5 is n5 = {6}, update q to {3, 5, 6} and set jump = 2. There is still jump < len, so mark V[5][0], then set V[5][0] = 3 and jump = 3. At this time, there is jump = len, so store q in Q[2] and set i = 3. The result of (3) is shown in Figure 10(c);(4)
There isV[3][0] = 4, node 4 is not marked, so set q = {4, 6} and jump = 1. Obviously, there is jump < len, but V[5][0] = 3, and there is q[0] > V[5][0], so set qp = Q[2] = {3, 5, 6} and nj = 3. The nodes set in front of q[1] is {4}, so insert 4 into the tail of qp and update the mark of 4, set V[3][0] = 3. If there are no other nodes after q[1], clear Q[2], update jump and set jump = jump + nj = 4, then update q and set q = qp = {3, 5, 6, 4}. At this time, there is jump = len, so store q in Q[2], then set i = 4. The result of (3) is shown in Figure 10(d);(5)
V[4][0] has been marked, so set i = 5. V[5][0] has been marked, so set i = 6;(6)
There isV[6][0] = 7, node 7 is not marked, so set q = {7, 8, 9, 10} and jump = 1. Obviously, there is jump < len, but V[7][0] = 1, and there is q[0] > V[7][0], so set qp = Q[0] = {1, 8} and nj = 2. The node set in front of q[1] is {7}, so insert 7 into the tail of qp and update the mark of 7, then set V[6][0] = 1. The node set after q[1] is {9, 10}, so update qp and set qp = {1, 8, 7, 9, 10}. After that, clear Q[0], update jump and set jump = jump + nj = 3, then update q and set q = qp = {1, 8, 7, 9, 10}. The result of (6) is shown in Figure 10(e);(7)
Obviously, there isjump < len, but V[8][0] = 2, and there is q[0] < V[8][0], so set qp = Q[1] = {2, 9, 10} and nj = 0. Store all nodes in front of q[3] into Y, there is Y = {1, 8, 7}, so store q[jump] and all nodes after it into G, and there is G = {9, 10}. Judge whether the nodes in qp are already in G in turn. Since 2 is not in G, insert 2 into the tail of Y, then update nj and set nj = 1. At the same time, update the marks of all nodes in qp, then set V[1][0] = 1, V[8][0] = 1, and V[9][0] = 1. After that, clear Q[1] and update jump, then set jump = Y.size() + 1 = 5. After that, insert G into the tail of Y, set q = Y = {1, 8, 7, 2, 9, 10}. There is still jump < len, but V[9][0] = 1, and there is q[0] = V[9][0], so update jump and set jump = 6. At this time, there is jump = len, so store q in Q[0] and set i = 7. V[7][0] is already marked, so set i = 8. V[8][0] is already marked, so set i = 9. V[9][0] is already marked, so set i = 10. i is out of index range, exit the loop. The result of (7) is shown in Figure 10(f).Figure 9
10 node topology analysis examples.Figure 10
Schematic diagram of 10 node topology analysis steps.
(a)(b)(c)(d)(e)(f)


## 4.1. Improved Abstract Description Method

For any node, if only the adjacent nodes whose node number is greater than itself are stored, the meaningless judgment operations mentioned above will undoubtedly be greatly reduced. When this scheme is adopted, the adjacency relationship between each node in Figure2 can be abstractly described by the array shown in Figure 8.Figure 8
Using arrays to describe the adjacency in Figure2 abstractly.However, it can be seen from Figure2 that 4 only has an adjacency relationship with 6. To obtain 4 through the traverse of the breadth-first method, 6 must be used as the medium. Since 4 < 6, 4 is not stored after V[5][0] in Figure 8. Obviously, the traditional topology analysis method is no longer applicable in the context of this abstract description method.


## 4.2. The Improved Breadth-First Search Method Based on Information Interaction

For the array that describes the adjacency relationship abstractly in Figure8, when using the traditional topology analysis method to analyze the busbar, store q = {1, 2, 5, 7, 3, 6, 8} formed in the first breadth-first search in Q[0], since V[3][0] is not marked, set q = {4, 6} and jump = 1, there is V[5][0] = 1. Through this mark, it can be found that 6 has been merged by 1. Therefore, the nodes in q should have a connectivity relationship with the node in Q[0]. Inspired by this, combined with the node labeling method, an improved breadth-first search method based on information interaction is proposed for the whole power network topology analysis. The basic steps are as follows:(1)
Traverse the arrayV that abstractly describes the adjacency relationship from top to bottom, i represents the row index of V, set i = 0. After that, go to (2);(2)
IfV[i][0] is not marked and the number of nodes in V[i] is greater than 1, create an array q to store connected nodes, and set q = V[i]. jump is the index of the node in q, and the initial value of jump is set to 1. len represents the number of nodes in q, which also changes dynamically when q is updated. After that, go to (3). If V[i][0] is not marked and the number of nodes in V[i] is equal to 1, i is not connected to any node, store i in Z and set i = i + 1, then go to (9). If V[i][0] is marked, set i = i + 1, then go to (9);(3)
Ifjump < len, go to (4). If jump = len, go to (8);(4)
Determine the relationship betweenq[jump] and V[q[jump] − 1][0]. If q[jump] = V[q[jump] − 1][0], go to (5). If q[0] > V[q[jump] − 1][0], go to (6). If q[0] < V[q[jump] − 1][0], go to (7). If q[0] = V[q[jump] − 1][0], set jump = jump + 1, then go to (3);(5)
MarkV[q[jump] − 1][0] and set V[q[jump] − 1][0] = q[0]. If the number of nodes in V[q[jump] − 1] is greater than 1, judge whether the nodes after V[q[jump] − 1][0] exist in q in turn, and insert the nodes not included at the end of q into q in turn. Finally, set jump = jump + 1, then go to (3). If the number of nodes in V[q[jump] − 1] is equal to 1, set jump = jump + 1, then go to (3);(6)
Find the row indexw in Q of the connected node set with V[q[jump] − 1][0] as the head node, set qp = Q[w]. Record the number of nodes nj in the current qp, insert all the nodes in front of q[jump] into the tail of qp in turn, and update the node’s mark to set it equal to V[q[jump] − 1][0]. After that, judge whether the node after q[jump] is already in qp in turn, if not, insert it into the tail of qp. Finally, clear Q[w], update jump, set jump = jump + nj, and update q, set q = qp, then go to (3);(7)
Find the row indexw in Q of the connected node set with V[q[jump] − 1][0] as the head node, and set qp = Q[w]. Obviously, it is impossible for all nodes in front of q[jump] to intersect with qp, but the nodes after q[jump] have the possibility of intersecting with qp. Therefore, store all nodes in front of q[jump] into Y, store q[jump] and all the nodes after it into G, and then judge whether the nodes in qp are already in G, if not, insert it into the tail of Y, and record the number of nodes inserted into the tail through nj. At the same time, update the marks of all nodes in qp to set it equal to q[0], which also leads to the possibility of q[0] = V[q[jump] − 1][0] mentioned in (4) in the later search process. Finally, clear Q[w], update jump, and set jump = Y.size() + 1, insert G into the tail of Y and set q = Y, then go to (3);(8)
Storeq in the first empty line Q[j] of Q and set i = i + 1, then go to (9);(9)
Ifi exceeds the index range, the topology analysis is complete, and exit the loop. Otherwise, go to (2).The pseudocode of the algorithm is shown in Algorithm2.Algorithm 2: Pseudocode of improved breadth-first search method based on information interaction. Algorithm name: Algorithm_B.
(1)
m = V.size();(2)
for (i = 0; i < m; i++) do(3)
ifV[i][0] = = i + 1 && V[i].size() > 1 then(4)
q = V[i];(5)
jump = 1;(6)
whilejump < lendo(7)
ifq[jump] = V[q[jump] − 1][0] then(8)
V[q[jump] − 1][0] = q[0];(9)
ifV[q[jump] − 1].size() > 1 then(10)
for (j = 1; j < V[q[jump] − 1].size(); j++) do(11)
ifV[q[jump] − 1][j] not in qthen(12)
q.push_back(V[q[jump] − 1][j]);(13)
end if;(14)
end for;(15)
end if;(16)
jump++;(17)
else ifq[0] > V[q[jump] − 1][0] then(18)
qp = Q[w];(19)
nj = qp.size();(20)
for (j = 0; j < jump; j++) do(21)
qp.push_back(q[j]);(22)
V[q[j] − 1][0] = V[q[jump] − 1][0];(23)
end for;(24)
for (j = jump + 1; j < q.size(); j++) do(25)
ifq[j] not in qpthen(26)
qp.push_back(q[j]);(27)
end if;(28)
end for;(29)
clearQ[w];(30)
jump = jump + nj;(31)
q = qp;(32)
else ifq[0] < V[q[jump] − 1][0] then(33)
qp = Q[w];(34)
nj = 0;(35)
for (j = 0; j < qp.size(); j++) do(36)
ifqp[j] not in Gthen(37)
Y.push_back(qp[j]);(38)
nj++;(39)
end if;(40)
V[qp[j] − 1][0] = q[0];(41)
end for;(42)
clearQ[w];(43)
jump = Y.size() + 1;(44)
q = [Y G];(45)
else ifq[0] = = V[q[jump] − 1][0] then(46)
jump++;(47)
end if;(48)
end while;(49)
Ts = Q.size();(50)
for (j = 0; j < Ts; j++) do(51)
ifQ[j] is empty then(52)
Q[j] = q;(53)
break;(54)
else ifQ[j] is not empty && j = = Ts − 1 then(55)
Q.push_back(q);(56)
end if;(57)
end for;(58)
else ifV[i][0] = = i + 1 && V[i].size() = = 1 then(59)
Z.push_back(i);(60)
end if;(61)
end for;In order to explain the meaning of each step in Algorithm_B more clearly, the example shown in Figure9 is designed, and the detailed derivation process, as shown below, is given.(1)
First, there isV[0][0] = 1, node 1 is not marked, so set q = {1, 8} and jump = 1. Obviously, there is jump < len, so mark V[7][0], then set V[7][0] = 1 and jump = 2. At this time, there is jump = len, so store q in Q[0], then set i = 1. The result of (1) is shown in Figure 10(a);(2)
There isV[1][0] = 2, node 2 is not marked, so set q = {2, 9, 10} and jump = 1. Obviously, there is jump < len, so mark V[8][0], then set V[8][0] = 2 and jump = 2. There is still jump < len, so mark V[9][0], then set V[9][0] = 2 and jump = 3. At this time, there is jump = len, so store q in Q[1], then set i = 2. The result of (2) is shown in Figure 10(b);(3)
There isV[2][0] = 3, node 3 is not marked, so set q = {3, 5} and jump = 1. Obviously, there is jump < len, so mark V[4][0] and set V[4][0] = 3, the set of adjacent nodes of 5 is n5 = {6}, update q to {3, 5, 6} and set jump = 2. There is still jump < len, so mark V[5][0], then set V[5][0] = 3 and jump = 3. At this time, there is jump = len, so store q in Q[2] and set i = 3. The result of (3) is shown in Figure 10(c);(4)
There isV[3][0] = 4, node 4 is not marked, so set q = {4, 6} and jump = 1. Obviously, there is jump < len, but V[5][0] = 3, and there is q[0] > V[5][0], so set qp = Q[2] = {3, 5, 6} and nj = 3. The nodes set in front of q[1] is {4}, so insert 4 into the tail of qp and update the mark of 4, set V[3][0] = 3. If there are no other nodes after q[1], clear Q[2], update jump and set jump = jump + nj = 4, then update q and set q = qp = {3, 5, 6, 4}. At this time, there is jump = len, so store q in Q[2], then set i = 4. The result of (3) is shown in Figure 10(d);(5)
V[4][0] has been marked, so set i = 5. V[5][0] has been marked, so set i = 6;(6)
There isV[6][0] = 7, node 7 is not marked, so set q = {7, 8, 9, 10} and jump = 1. Obviously, there is jump < len, but V[7][0] = 1, and there is q[0] > V[7][0], so set qp = Q[0] = {1, 8} and nj = 2. The node set in front of q[1] is {7}, so insert 7 into the tail of qp and update the mark of 7, then set V[6][0] = 1. The node set after q[1] is {9, 10}, so update qp and set qp = {1, 8, 7, 9, 10}. After that, clear Q[0], update jump and set jump = jump + nj = 3, then update q and set q = qp = {1, 8, 7, 9, 10}. The result of (6) is shown in Figure 10(e);(7)
Obviously, there isjump < len, but V[8][0] = 2, and there is q[0] < V[8][0], so set qp = Q[1] = {2, 9, 10} and nj = 0. Store all nodes in front of q[3] into Y, there is Y = {1, 8, 7}, so store q[jump] and all nodes after it into G, and there is G = {9, 10}. Judge whether the nodes in qp are already in G in turn. Since 2 is not in G, insert 2 into the tail of Y, then update nj and set nj = 1. At the same time, update the marks of all nodes in qp, then set V[1][0] = 1, V[8][0] = 1, and V[9][0] = 1. After that, clear Q[1] and update jump, then set jump = Y.size() + 1 = 5. After that, insert G into the tail of Y, set q = Y = {1, 8, 7, 2, 9, 10}. There is still jump < len, but V[9][0] = 1, and there is q[0] = V[9][0], so update jump and set jump = 6. At this time, there is jump = len, so store q in Q[0] and set i = 7. V[7][0] is already marked, so set i = 8. V[8][0] is already marked, so set i = 9. V[9][0] is already marked, so set i = 10. i is out of index range, exit the loop. The result of (7) is shown in Figure 10(f).Figure 9
10 node topology analysis examples.Figure 10
Schematic diagram of 10 node topology analysis steps.
(a)(b)(c)(d)(e)(f)


## 5. Example Analysis

Taking the power grid with a scale of 10000 nodes as an example, the partial original data of power network topology analysis after basic processing are given, as shown in Table4. It contains a series of information such as node number, transformer ratio, equipment position and status, and node voltage. For the third column in Table 4, 0 means that switch elements are installed between two nodes. If it is a non-0 element, it means that transformers are installed between two nodes, and this value is equal to the transformer ratio. For the fourth column in Table 4, 1 means the component is put into use, and 0 means the component is not put into use. The CPU of the device is Intel® Core™ i7-11700@2.50 GHz, and the running memory is 16 GB. In the Visual Studio 2017 development environment, the effects of different scales of power grids, different node numbering optimation methods, and different algorithms on the average running time are compared, as shown in Table 5. The average running time here refers to the average of time it takes for the algorithm to execute 100 times. At the same time, the running times of different schemes are visualized, as shown in Figure 11. Taking Figure 11(a) as an example, the first column represents the node numbering optimization technology selected in the busbar analysis process. The second column represents the topology analysis algorithm selected in the busbar analysis process. The third column represents the node numbering optimization technology in the process of topological island analysis. The fourth column represents the topology analysis algorithm in the process of topological island analysis. The fifth column represents the average execution time of the method under the combination scheme of the first four columns.Table 4
Partial original data of power network topology analysis.
Number of nodeiNumber of nodejRatioStatusThe voltage of nodei (kV)The voltage of nodej (kV)……100021000101138138……100111000101138138……100141000201138138……100041000301138138…………………………………………20366203651.043751138345…………………………………………8008780090112301……8008880090111151……800888010001115115……80089800901113.81……Table 5
Performance comparison.
Number of nodes2000Busbar analysisNode numbering optimation methodNode sequence numberingNumbering the nodes according to the number of outgoing lines from more to lessNumbering the nodes adjacent to the switch preferentiallyAlgorithmABABABTime (ms)12.325215.589711.766111.438710.60839.7771Topological island analysisNode numbering optimation methodNode sequence numberingNumbering the nodes according to the number of outgoing lines from more to lessAlgorithmABABTime (ms)0.60220.54750.39540.3436Number of nodes:10000Busbar analysisNode numbering optimation methodNode sequence numberingNumbering the nodes according to the number of outgoing lines from more to lessNumbering the nodes adjacent to the switch preferentiallyAlgorithmABABABTime (ms)66.35170.552864.913968.221956.824646.5273Topological island analysisNode numbering optimation methodNode sequence numberingNumbering the nodes according to the number of outgoing lines from more to lessAlgorithmABABTime (ms)5.13698.97795.0124.7488Number of nodes:25000Busbar analysisNode numbering optimation methodNode sequence numberingNumbering the nodes according to the number of outgoing lines from more to lessNumbering the nodes adjacent to the switch preferentiallyAlgorithmABABABTime (ms)151.139352.029144.062333.1457120.536597.833Topological island analysisNode numbering optimation methodNode sequence numberingNumbering the nodes according to the number of outgoing lines from more to lessAlgorithmABABTime (ms)16.254220.990315.684915.459Figure 11
A comparison chart of average running time. (a) 2000 nodes. (b) 10000 nodes. (c) 25000 nodes.
(a)(b)(c)It can be found from the above chart that the node numbering optimization method will have a greater impact on the efficiency of topology analysis. In the process of busbar analysis, if the traditional node numbering method is used, the efficiency of the algorithm proposed in this paper has no advantage compared with the traditional algorithm. This is because the method proposed in this paper is mainly based on the node labeling method so that the busbar (or topological island) undergoing breadth-first search has an information interaction with the busbar (or topological island) whose connectivity relationship has been determined. When the traditional node numbering method is used, the array structure that abstractly describes the adjacency relationship between nodes is relatively scattered, which leads to the possibility of storing multiple groups of busbars (or topological islands) with connectivity relationship inQ at the same time. Even if the algorithm proposed in this paper avoids the disadvantages of the traditional method, the advantage of the proposed algorithm is overshadowed by the huge time overhead caused by frequent information interaction in this case. However, when using the node numbering method, in which the nodes adjacent to the switch are numbered preferentially proposed in this paper, it can be found that the performance of the algorithm proposed in this paper is significantly improved, and the operating efficiency also exceeds the traditional algorithm. This is because when the node numbering optimization method proposed in this paper is adopted, the scale of Q in the algorithm execution process is generally kept at a low level. Compared with the traditional node numbering optimation method, the number of information interactions can be effectively reduced, thereby significantly reducing the time overhead. In the process of topological island analysis, if the nodes are numbered according to the principle of numbering the number of node outgoing lines from more to less, compared with the node sequence numbering, the performance of the algorithm proposed in this paper will also be significantly improved, and the operating efficiency will be slightly higher than the traditional algorithm. This is because the object of topological island analysis is topology nodes, and the number of such nodes is often small. For small and medium-sized nodes, the possibility of frequent interaction is relatively low. Compared with traditional algorithms, the advantages of the algorithm proposed in this paper are reflected.


## 6. Conclusion

The task of power network topology analysis is to analyze the topology of the power grid according to the status and location information of the power grid components given by the system after the network structure of the power grid changes, and quickly and accurately build the power system analysis and calculation model to identify isolated subsystems. The main conclusions are as follows:(1)
A node numbering optimization method in which the nodes adjacent to the switch are numbered preferentially, which can identify the independent busbar before the busbar analysis, and assist the topology analysis algorithm to effectively reduce the calculation amount, thereby improving the efficiency of the algorithm operation;(2)
A new abstract expression method of adjacency relationship and an improved breadth-first search method applied to power network topology analysis based on information interaction are proposed. When using the traditional node numbering optimization method, compared with traditional method, this method has certain advantages in the application of topology analysis of small and medium-scale power grids. In the face of a large-scale power grid, with the aid of the node numbering optimization method proposed in this paper, an acceleration effect of about 20% can be obtained;(3)
This method can provide a reference for the study of graph connectivity, and can be further extended to the fields of transportation, social interaction, finance, medical care, etc., and has a high interdisciplinary.The outlook for future related research work is as follows: During the collection, transmission, and exchange of measurement data required for power network topology analysis, some data information will be damaged or deviated due to equipment or network reasons, resulting in bad data. In this case, the accuracy of power network topology analysis results may be affected to some extent. We usually call the topology error correction process after power network topology analysis as power network topology error identification. Generally speaking, the purpose of power network topology error identification is to eliminate part of the error information of the topology result in the process of state estimation, or to identify the topology error independently by using the characteristics of bad data, to correct the topology result, and replace the bad data. In addition, the dynamic thermal rating system (DTR) can be combined with network topology optimization (NTO) to maximize the deployment of transmission assets in a highly flexible way and improve the reliability of the power system [19]. DTR can dynamically evaluate the maximum transmission capacity of the transmission line according to the weather conditions around the conductor, and increase the transmission capacity without investing in the construction of new lines. As a new type of power system operation strategy, NTO can change the transmission topology according to the operation conditions, potentially minimize the load shedding in an emergency [20], and also alleviate network congestion and improve the flexibility of the network by optimizing the switching of lines and busbars [21]. The coordination of these two cost-effective technologies can bring economic and reliability advantages to the power grid [22]. Compared with the traditional network topology optimization technology, under the joint deployment framework of DTR and NTO, the average number of line or busbar switching operations is often lower, but it can significantly improve the reliability of the system. The theoretical results of the topology optimization scheme obtained can be used as a reference to judge whether the original data of the power network topology analysis have problems, it can also provide new ideas for the subsequent network topology error identification and the correction of various parameters in the application of power system analysis. Therefore, in the future, we will study the optimization scheme of power network topology error identification technology with the input of the DTR and NTO joint deployment system.



---

*Source: 9990917-2023-02-15.xml*