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

the


Introduction
Te power network topology analysis is based on the realtime data of the power system.Te real-time topology of the entire network is obtained by refning 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.Te 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][2][3], power fow calculation optimization [4,5], power system safety analysis [6,7], and relay protection device coordination [8].
Te essence of power network topology analysis is the problem of network connectivity.Te most common methods are the search method, matrix method, and related algorithms combined with new technologies.Te 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 selfmultiplication to improve the operation efciency of the algorithm.Yao et al. [11] used sparse technology to simplify matrix storage, optimize the traditional matrix method, and achieve signifcant acceleration.Compared with the matrix method, the search method does not need to perform largescale matrix self-multiplication calculations, which saves memory resources.Te 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-frst search method with good scalability and compatibility.Tis method adopts the idea of "frst 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 efciency of the algorithm.Bose and Clements [13] realized the real-time modeling of the power network based on the breadth-frst search algorithm, which traversed all the nodes adjacent to the root node according to the idea of "frst in, frst 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 efciency.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 classifcation method, which determined the network topology of the power system through diferent switch types, realized the coordination of plant-station topology analysis and system topology analysis, and improved the efciency 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.Terefore, if numbering the nodes adjacent to the switch preferentially, the independent busbar can be fltered out in advance, thereby reducing the search dimension.Te 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-frst 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 B ij adjacent to i are also adjacent to j.Since B ij has formed a connectivity relationship with i, when searching for nodes adjacent to j, the computer will still judge whether B ij 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 defnes 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-frst search is no longer complete in most cases.To this end, this paper presents an improved breadthfrst 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-frst search and the busbar (or topological island) that is undergoing breadth-frst 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 diferent scales to verify the efectiveness.
Te paper is organized as follows: Section 2 takes the 17 node power system as an example to analyze the numbering logic of diferent node numbering optimization technologies.Section 3 introduces the basic steps of the traditional power network topology analysis method based on the breadth-frst 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-frst search method is designed.In Section 5, the acceleration efect of the proposed method in large-scale scenes is verifed by experiments.Section 6 gives a summary and discusses some ideas for future work.

Node Numbering Optimization Technology
Te 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 diferent.Terefore, the order of node numbering optimization will afect the efciency of power network topology analysis to a certain extent.

Node Sequence Numbering.
As shown in Figure 1, 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.Te node sequence numbering has the characteristics of a simple structure but is relatively unscientifc at the same time.Tis method is used to number the nodes in Figure 1, and the results are shown in Table 1.

Numbering the Nodes According to the Number of Out-
going Lines from More to Less.Since the topology analysis based on the breadth-frst search method will traverse the nodes of the whole graph in turn, before the frst search or after each time the complete connectivity relationship 2 Mathematical Problems in Engineering between some nodes is determined, it is possible to have an adjacency with more nodes if the frst unlabeled node k 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 efciency generally.Te nodes in Figure 1 are numbered using this method, and the results are shown in Table 2.

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 Figure 1.Te 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 efciency of busbar analysis to a certain extent.Terefore, a node numbering optimization method is proposed in which the nodes adjacent to the switch are numbered preferentially.Te nodes adjacent to the switch are sorted from more to less according to the number of adjacent switch components.Tis is because whether there is an adjacency relationship between two nodes mainly depends on the on-of 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 frst, it will increase the number of judgments on whether some nodes have been merged.Generally speaking, the average search efciency 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 Figure 1 are numbered, and the numbering results are shown in Table 3.

Traditional Power Network Topology Analysis Method Based on the Breadth-First Search Method
Te 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 efciency of the search method, and the demand for system memory is much smaller.Terefore, the search method has unique advantages in the face of largescale power network topology analysis problems.Te 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.Ten, 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.

Te Traditional Abstract Description Method of Adjacency
Relationship.Te nodes in Figure 1 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 identifed 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.Te frst 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 specifed position in turn after each node.Te adjacency relationship between nodes in Figure 2 can be abstractly described by the array shown in Figure 3.

Traditional Power Network Topology Analysis Method
Based on the Breadth-First Search Method.Search methods are generally divided into the depth-frst algorithm and breadth-frst algorithm.In terms of operation efciency, the breadth-frst search method is more suitable for topology analysis than the depth-frst search algorithm [17].Te breadth-frst 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.Mathematical Problems in Engineering 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 breadthfrst search method ends.Te steps of the traditional power network topology analysis method based on the breadth-frst search method are as follows: (1) Traverse the array V 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 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) If jump < len, go to (4).If jump = len, go to ( 5 is greater than 2, it means that it may contain additional nodes that can form a connectivity relationship with the nodes in q.Terefore, judge whether the nodes after 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 ; (5) Te nodes in q have formed a completely connectivity relationship, and q is stored in Q.After that, set i = i + 1, go to (6); (6) If i exceeds the index range, the topology analysis is complete, and exit the loop.Otherwise, go to (2).
Te pseudocode of the algorithm is shown in Algorithm1.
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.Te numbering results are shown in Figure 5. Ten, using the breadth-frst topology analysis method, all the busbars with electrical connections are merged into topological islands.Finally, the topological island analysis is completed.Te research objects of busbar Mathematical Problems in Engineering analysis and topological island analysis are diferent, but the steps are the same.Terefore, the process of topological island analysis will not be repeated here.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 Figure 1, the adjacency relationship between the nodes is shown in Figure 6 and can be abstractly described by the array shown in Figure 7.
Compared with the busbar analysis process of the array describing the adjacency relationship in Figure 3, the main diference is that the number of times judging whether the nodes in the adjacent node set n i exist in q is signifcantly increased.Terefore, 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 efciency 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.

An Improved Breadth-First Search Method Based on Information Interaction
Te traditional method uses an array to describe the complete adjacency relationship between nodes abstractly.Terefore, the complete connectivity analysis between nodes can be realized by the breadth-frst 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.Tis kind of meaningless operation will bring more time overhead when the node scale expands.

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 Figure 2 can be abstractly described by the array shown in Figure 8.However, it can be seen from Figure 2 that 4 only has an adjacency relationship with 6.To obtain 4 through the traverse of the breadth-frst 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.

Te Improved Breadth-First Search Method Based on
Information Interaction.For the array that describes the adjacency relationship abstractly in Figure 8, when using the traditional topology analysis method to analyze the busbar, store q � {1, 2, 5, 7, 3, 6, 8} formed in the frst breadth-frst search in Q[0], since V [3][0] is not marked, set q � {4, 6} and jump � 1, there is V [5][0] � 1. Trough this mark, it can be found that 6 has been merged by 1. Terefore, 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-frst search method based on information interaction is proposed for the whole power network topology analysis.Te basic steps are as follows: (1) Traverse the array V that abstractly describes the adjacency relationship from top to bottom, i represents the row index of V, set i � 0. After that, go to 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) If jump < len, go to (4).If jump � len, go to (8); (4) Determine the relationship between q[jump] and V 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 . Record the number of nodes n j in the current q p , insert all the nodes in front of q[jump] into the tail of q p in turn, and update the node's mark to set it equal to After that, judge whether the Mathematical Problems in Engineering node after q[jump] is already in q p in turn, if not, insert it into the tail of q p .Finally, clear Q[w], update jump, set jump � jump + n j , and update q, set q � q p , then go to (3); (7) Find the row index w in Q of the connected node set with V[q[jump] − 1][0] as the head node, and set Obviously, it is impossible for all nodes in front of q[jump] to intersect with q p , but the nodes after q[jump] have the possibility of intersecting with q p .Terefore, 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 q p are already in G, if not, insert it into the tail of Y, and record the number of nodes inserted into the tail through n j .At the same time, update the marks of all nodes in q p to set it equal to q[0], which also leads to the possibility of q (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) Store q in the frst empty line Q[j] of Q and set i � i + 1, then go to (9); (9) If i exceeds the index range, the topology analysis is complete, and exit the loop.Otherwise, go to (2).
Te pseudocode of the algorithm is shown in Algorithm 2.
In order to explain the meaning of each step in Algo-rithm_B more clearly, the example shown in Figure 9 is designed, and the detailed derivation process, as shown below, is given.

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 Table 4.
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.
Te CPU of the device is Intel ® Core ™ i7-11700@2.50GHz, and the running memory is 16 GB.In the Visual Studio 2017 development environment, the efects of diferent scales of power grids, diferent node numbering optimation methods, and diferent algorithms on the average running time are compared, as shown in Table 5. Te 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 diferent schemes are visualized, as shown in Figure 11.
Taking Figure 11(a) as an example, the frst column represents the node numbering optimization technology selected in the busbar analysis process.Te second column represents the topology analysis algorithm selected in the busbar analysis process.Te third column represents the node numbering optimization technology in the process of topological island analysis.Te fourth column represents the topology analysis algorithm in the process of topological island analysis.Te ffth column represents the average execution time of the method under the combination scheme of the frst four columns.It can be found from the above chart that the node numbering optimization method will have a greater impact on the efciency of topology analysis.In the process of busbar analysis, if the traditional node numbering method is used, the efciency of the algorithm proposed in this paper has no advantage compared with the traditional algorithm.Tis 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-frst 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 in Q 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 signifcantly improved, and the operating effciency also exceeds the traditional algorithm.Tis 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 efectively reduced, thereby signifcantly 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 signifcantly improved, and the operating efciency will be slightly higher than the traditional algorithm.Tis 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 refected.

Conclusion
Te 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.Te 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 efectively reduce the calculation amount, thereby improving the efciency of the algorithm operation; (2) A new abstract expression method of adjacency relationship and an improved breadth-frst 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 efect of about 20% can be obtained; (3) Tis method can provide a reference for the study of graph connectivity, and can be further extended to the felds of transportation, social interaction, fnance, medical care, etc., and has a high interdisciplinary.
Te 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 afected to some extent.We usually call the topology error correction process after power network topology analysis as power network topology error identifcation.Generally speaking, the purpose of power network topology error identifcation 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 fexible 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 fexibility of the network by optimizing the switching of lines and busbars [21].Te coordination of these two cost-efective 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 signifcantly improve the reliability of the system.Te 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 identifcation and the correction of various parameters in the application of power system analysis.Terefore, in the future, we will study the optimization scheme of power network topology error identifcation technology with the input of the DTR and NTO joint deployment system.

Figure 3 :
Figure 3: Using arrays to describe the adjacency in Figure 2 abstractly.

Figure 8 :
Figure 8: Using arrays to describe the adjacency in Figure 2 abstractly.

Table 1 :
Numbering the nodes in order of node sequence.

Table 2 :
Numbering the nodes according to the number of outgoing lines from more to less.

Table 3 :
Numbering the nodes adjacent to the switch preferentially.

Table 4 :
Partial original data of power network topology analysis.