Resource topology sorting method and device, equipment and storage medium
By constructing a target matrix and performing N target operations to generate a target list, the complexity of graph theory depth-first or breadth-first search methods and the consistency issues in maintaining graph databases are resolved, thus improving the efficiency of network resource topology sorting.
Patent Information
- Application Number
- CN202211689375.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-12-27
AI Technical Summary
In existing technologies for network resource topology sorting, graph theory depth-first search or breadth-first search methods are computationally complex and inefficient, while introducing graph databases requires maintaining data consistency and incurs high costs.
By constructing a target matrix, performing N target operations, obtaining target information to generate a target list, and utilizing structured query language to improve the efficiency of topological sorting.
It simplifies the topology sorting process, improves the sorting efficiency of network resources, and reduces system complexity and cost.
Smart Images

Figure CN116248512B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular to a resource topology sorting method and device, equipment and a storage medium. BACKGROUND
[0002] In the network resource visualization system of an operator, when performing topology sorting on network resources, a topology model of the network resources can be first expressed in the form of a graph, and then based on the topology model of the network resources, a topology relationship of the entire system is constructed through a topology algorithm of the graph, so as to convert topology analysis on the network resources into topology analysis on the graph. Specifically, the topology model of the network resources can be first converted into a directed graph G=(V, E(S)) (V is a node set, E is a directed edge set, and S is an attribute of the edge), and then a stack technology is used to search the topology model of the network resources, so as to express the topology structure of the network resources as a linked list relationship, and thus based on the topology structure of the network resources, the network resources are sorted through a depth or breadth search method of graph theory.
[0003] When performing topology sorting on the network resources, a graph database (for example, NEO4J) can also be introduced to simplify topology calculation when performing topology sorting on the network resources. Specifically, a logic modeling method similar to a relational database can be used to construct a graph pattern (main patterns are nodes, relationships, and attributes) of the network resources according to a pattern of the graph database. After the graph pattern is constructed, data can be imported from an information system to the graph pattern according to the pattern of the graph database, so as to perform topology sorting on the network resources according to a query language provided by the graph database.
[0004] In the above method, when the network resources are sorted through the depth or breadth search method of graph theory, the program for topology sorting needs to be in a recursive form, which leads to complex programming and maintenance of the program, and in a real-time operation scenario, the operation efficiency is low. When the network resources are sorted by introducing the graph database, data consistency between the original system database and the graph database needs to be maintained, which increases the complexity of the system, and at the same time, since the query language of the graph database does not have a unified standard, the use threshold of the graph database is high, and the cost is large. Thus, the efficiency of topology sorting on the network resources is low. SUMMARY
[0005] The present application provides a resource topology sorting method, device, equipment and storage medium, which is used to solve the problems of complex operation process of topology sorting through the depth or breadth search method of graph theory and the need to maintain data consistency when topology sorting is performed by introducing a graph database, so as to improve the efficiency of topology sorting on network resources.
[0006] To achieve the above object, the present application adopts the following technical solutions:
[0007] In a first aspect, a resource topology sorting method is provided. The method includes: constructing a target matrix based on connection relationships between a plurality of network resources, the target matrix including three types of numerical values; wherein a first type of numerical value indicates that a network resource itself has a connection relationship, a second type of numerical value indicates that an i-th network resource has a connection relationship with a j-th network resource, and a third type of numerical value indicates that an i-th network resource does not have a connection relationship with a j-th network resource, i and j are positive integers; performing N times of target operations on the target matrix to obtain N target results, until it is determined that there is no target information in a result obtained from an (N+1)th target operation, the target operation is ended; wherein the Nth target operation is: determining an (N+1)th power of the target matrix, the target information is used to indicate that two network resources have a connection relationship, and N is a positive integer; obtaining a plurality of target information from the target matrix and the N target results, and obtaining a target list based on the plurality of target information, the target list including a plurality of connection relationships, and a connection relationship is used to indicate a corresponding step length between two network resources having a connection relationship.
[0008] In a possible implementation, the constructing of the target matrix based on the connection relationships between the plurality of network resources includes: constructing a target directed graph based on the connection relationships between the plurality of network resources, the target directed graph including a plurality of entities and a plurality of directed connection lines, an entity in the plurality of entities is used to indicate a network resource, and a directed connection line in the plurality of directed connection lines is used to indicate a connection relationship between two network resources; constructing a connection relationship table based on the target directed graph, and constructing the target matrix through the connection relationship table, the connection relationship table is used to indicate a connection relationship between two network resources corresponding to each directed connection line in the plurality of directed connection lines.
[0009] In a possible implementation, the obtaining of the plurality of target information from the target matrix and the N target results, and the obtaining of the target list based on the plurality of target information includes: determining two network resources having a connection relationship indicated by each second type of numerical value in at least one second type of numerical value included in the target matrix, one second type of numerical value in the at least one second type of numerical value being one target information; constructing a preset list including at least one connection relationship based on the two network resources having a connection relationship indicated by each second type of numerical value in the at least one second type of numerical value; sequentially obtaining a plurality of target information from the N target results, and adding a plurality of connection relationships indicated by the plurality of target information to the preset list to obtain the target list, at least one target information being included in one target result.
[0010] In a possible implementation, the method further includes: when a network resource that needs to be determined to have a connection relationship with the target network resource and that corresponds to a step length less than or equal to the target step length is required, obtaining the required network resource from the target list by using a structured query language (SQL) statement.
[0011] In a second aspect, a resource topology sorting apparatus is provided, and the resource topology sorting apparatus includes: a processing unit and an obtaining unit; the processing unit is configured to construct a target matrix based on connection relationships among a plurality of network resources, the target matrix including three types of values; a first type of value indicates that one network resource has a connection relationship by itself, a second type of value indicates that an i th network resource has a connection relationship with a j th network resource, and a third type of value indicates that an i th network resource does not have a connection relationship with a j th network resource, i and j are positive integers; the processing unit is further configured to perform a target operation on the target matrix N times to obtain N target results, until it is determined that there is no target information in a result obtained from an (N+1) th target operation, the target operation is ended; the (N) th target operation is: determining an (N+1) th power of the target matrix, the target information is used to indicate that two network resources have a connection relationship, and N is a positive integer; the obtaining unit is configured to obtain a plurality of target information from the target matrix and the N target results, and obtain a target list based on the plurality of target information, the target list includes a plurality of connection relationships, and one connection relationship is used to indicate a corresponding step length between two network resources that have a connection relationship.
[0012] In a possible implementation, the processing unit is further configured to construct a target directed graph based on the connection relationships among the plurality of network resources, the target directed graph including a plurality of entities and a plurality of directed connection lines, one entity in the plurality of entities is used to indicate one network resource, and one directed connection line in the plurality of directed connection lines is used to indicate a connection relationship between two network resources; the processing unit is further configured to construct a connection relationship table based on the target directed graph, and construct the target matrix by using the connection relationship table, the connection relationship table is used to indicate a connection relationship between two network resources corresponding to each directed connection line in the plurality of directed connection lines.
[0013] In a possible implementation, the resource topology sorting apparatus further includes a determination unit; the determination unit is configured to determine two network resources having a connection relationship indicated by each of at least one second type of value based on the at least one second type of value included in the target matrix, one of the at least one second type of value being one target information; the processing unit is further configured to construct a preset list including at least one connection relationship based on the two network resources having the connection relationship indicated by each of the at least one second type of value; the acquisition unit is further configured to acquire a plurality of target information from the N target results in sequence; and the processing unit is further configured to add a plurality of connection relationships indicated by the plurality of target information to the preset list to obtain a target list, at least one target information being included in one target result.
[0014] In a possible implementation, the acquisition unit is further configured to acquire, from the target list, a network resource required to be determined to have a connection relationship with a target network resource and to correspond to a step length less than or equal to a target step length, by using a structured query language (SQL) statement.
[0015] In a third aspect, an electronic device includes a processor and a memory; the memory is configured to store one or more programs including computer execution instructions; when the electronic device is running, the processor executes the computer execution instructions stored in the memory, so that the electronic device performs a resource topology sorting method according to the first aspect.
[0016] In a fourth aspect, a computer readable storage medium storing one or more programs is provided, the one or more programs including instructions that, when executed by a computer, cause the computer to perform a resource topology sorting method according to the first aspect.
[0017] The application provides a resource topology sorting method and device, equipment and a storage medium, which are applied to a scenario of topology sorting of network resources. When it is necessary to perform topology sorting on network resources, a target matrix including three types of values can be constructed based on the connection relationship between a plurality of network resources, wherein the first type of value indicates that one network resource itself has a connection relationship, the second type of value indicates that the ith network resource has a connection relationship with the jth network resource, and the third type of value indicates that the ith network resource does not have a connection relationship with the jth network resource. Further, N target operations are performed on the target matrix until it is determined from the result obtained from the N+1th target operation that there is no target information indicating that two network resources have a connection relationship, N target results are obtained, and the target operation is ended. Further, a plurality of target information is obtained from the target matrix and the N target results, and a target list including a plurality of connection relationships is obtained based on the plurality of target information to indicate the corresponding step length between two network resources having a connection relationship. Through the above method, when it is necessary to perform topology sorting on network resources, a target matrix can be constructed based on the connection relationship between a plurality of network resources, and then N target operations are performed on the target matrix to obtain N target results, so as to obtain a plurality of target information from the target matrix and the N target results, and obtain a target list based on the plurality of target information. Thus, the problem of complex operation process of topology sorting by a depth or breadth search method of graph theory and the problem of maintaining data consistency when topology sorting is introduced by a graph database are solved. Therefore, the efficiency of topology sorting of network resources is improved. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1 A structural schematic diagram of a resource topology sorting system provided for an embodiment of the application;
[0019] Figure 2 A resource topology sorting method flowchart provided for an embodiment of the application Figure 1 ;
[0020] Figure 3 A resource topology sorting method flowchart provided for an embodiment of the application Figure 2 ;
[0021] Figure 4 A schematic diagram of a directed graph provided for an embodiment of the application;
[0022] Figure 5 A schematic diagram of an adjacency matrix M1 provided for an embodiment of the application;
[0023] Figure 6 A resource topology sorting method flowchart provided for an embodiment of the application Figure 3 ;
[0024] Figure 7 A schematic diagram of an adjacent square matrix M2 provided for an embodiment of the present application;
[0025] Figure 8 A schematic diagram of an adjacent square matrix M3 provided for an embodiment of the present application;
[0026] Figure 9 A schematic diagram of a resource topology sorting method flow provided for an embodiment of the present application Figure 4 ;
[0027] Figure 10 A schematic diagram of a resource topology sorting device structure provided for an embodiment of the present application;
[0028] Figure 11 A schematic diagram of an electronic device structure provided for an embodiment of the present application. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
[0030] In the description of the present application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this document is only a description of the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can mean that A exists alone, A and B exist together, and B exists alone. In addition, "at least one" "multiple" means two or more. "First", "second", etc. do not limit the quantity and execution order, and "first", "second", etc. do not necessarily mean different.
[0031] At present, in the network resource visualization system of the operator, the structure description and topology sorting of the network resource have an important position, and are the cornerstone of many business applications. When the network resource is topologically sorted, the topology model of the network resource can be first expressed in the form of a graph, and then based on the topology model of the network resource, the topology relationship of the entire system is constructed through the topology algorithm of the graph, so as to convert the topology analysis of the network resource into the topology analysis of the graph. Specifically, the topology model of the network resource can be first converted into a directed graph G=(V, E(S)), and then the topology model of the network resource is searched by using the stack technology, so as to express the topology structure of the network resource as a linked list relationship, so that based on the topology structure of the network resource, the network resource is topologically sorted by using the depth or breadth search method of graph theory.
[0032] In the topology sorting of the network resources, a graph database can also be introduced to simplify the topology calculation in the topology sorting of the network resources. Specifically, a graph database mode can be constructed according to a graph database mode in a manner similar to logical modeling of a relational database. After the graph mode is constructed, data can be imported from the information system to the graph mode according to the graph database mode, so as to perform the topology sorting of the network resources according to a query language provided by the graph database.
[0033] In the above method, the graph theory-based method generally adopts a stack technology to search the topology model of the network resources, so as to express the topology structure of the network resources as a linked list relationship. Therefore, when the topology analysis is performed by using the depth or breadth search method of the graph theory, the program for the topology sorting inevitably adopts a recursive form, the programming and maintenance of the program are relatively complex, and the operation efficiency is relatively low in the real-time operation scenario. The graph database-based method simplifies the development, but needs to maintain the data consistency between the original system database and the graph database, which increases the complexity of the system. In addition, since the query language of the graph database does not have a unified standard like the structured query language (SQL), the use threshold of the graph database is relatively high, and the cost of the project is relatively large.
[0034] The present application provides a resource topology sorting method. When the topology sorting of the network resources is needed, a target matrix including three types of values can be constructed based on the connection relationship between a plurality of network resources, wherein the first type of value indicates that a network resource itself has a connection relationship, the second type of value indicates that the ith network resource has a connection relationship with the jth network resource, and the third type of value indicates that the ith network resource does not have a connection relationship with the jth network resource. Further, N target operations are performed on the target matrix until it is determined from the result of the N+1th target operation that there is no target information indicating that two network resources have a connection relationship, N target results are obtained, and the target operation is ended. Furthermore, a plurality of target information is obtained from the target matrix and the N target results, and a target list including a plurality of connection relationships is obtained based on the plurality of target information to indicate the corresponding step length between two network resources having a connection relationship. Through the above method, when the topology sorting of the network resources is needed, a target matrix can be constructed based on the connection relationship between a plurality of network resources, and then N target operations are performed on the target matrix to obtain N target results, so as to obtain a plurality of target information from the target matrix and the N target results, and obtain a target list based on the plurality of target information. Thus, the problem of complex operation process in the topology sorting by using the depth or breadth search method of the graph theory, and the problem of the need to maintain the data consistency in the topology sorting by introducing the graph database are solved. Therefore, the efficiency of the topology sorting of the network resources is improved.
[0035] The resource topology sorting method provided by the embodiment of the application can be applied to a resource topology sorting system. Figure 1 A structural diagram of the resource topology sorting system is shown. As shown in Figure 1 The resource topology sorting system 20 includes a server 21 and a terminal device 22. The server 21 is configured to acquire a connection relationship between a plurality of network resources, construct a target matrix based on the connection relationship between the plurality of network resources, perform N target operations on the target matrix to obtain N target results, and send the target matrix and the N target results to the terminal device 22. The terminal device 22 is configured to receive the target matrix and the N target results sent by the server 21, acquire a plurality of target information from the target matrix and the N target results, and obtain a target list based on the plurality of target information, so as to realize topology sorting of the network resources by the server 21 and the terminal device 22.
[0036] A resource topology sorting method provided by the embodiment of the application is described below with reference to the accompanying drawings. As shown in Figure 2 The resource topology sorting method provided by the embodiment of the application is applied to an electronic device, and the method includes S201-S203.
[0037] S201, constructing a target matrix based on a connection relationship between a plurality of network resources.
[0038] The target matrix includes three types of values. The first type of value indicates that one network resource itself has a connection relationship. The second type of value indicates that the ith network resource has a connection relationship with the jth network resource. The third type of value indicates that the ith network resource does not have a connection relationship with the jth network resource. i and j are both positive integers.
[0039] It can be understood that the electronic device can construct a target directed graph based on the connection relationship between the plurality of network resources, then construct a connection relationship table based on the target directed graph, and construct the target matrix through the connection relationship table.
[0040] Optionally, V and E in the target directed graph G=(V, E) (wherein G represents a directed graph, V represents a point entity, and E represents a directed connection line) can be converted into R (i.e., a connection relationship table, including a (V set entity (RME_EQP) and an E set entity (PUB_LOG_CIRCUIT)) of a relational database, respectively, and the V set entity and the E set entity are persisted (i.e., stored), then the E set entity is expressed in the form of an adjacency matrix to obtain a target matrix. The target matrix can be referred to as M1, in which if e(i, j) is 0, it indicates that a network resource itself has a connection relationship, if e(i, j) is 1, it indicates that the i th network resource has a direct connection relationship with the j th network resource, and if e(i, j) is ∞, it indicates that the i th network resource does not have a connection relationship with the j th network resource.
[0041] S202, performing N target operations on the target matrix to obtain N target results, until it is determined that there is no target information in the result obtained from the N+1 th target operation, the execution of the target operation is ended.
[0042] Wherein, the N th target operation is to determine the (N+1) th power of the target matrix, the target information is used to indicate that two network resources have a connection relationship, and N is a positive integer.
[0043] It can be understood that the electronic device can perform N target operations on the target matrix to obtain N target results, until it is determined that there is no target information in the result obtained from the N+1 th target operation, the execution of the target operation is ended.
[0044] Optionally, the (N+1) th power of the target matrix (i.e., M(N+1)) can be obtained after performing the N+1 th target operation, if e(i, j) in M(N+1) is all 0 and ∞, it is determined that there is no target information in M(N+1), and the execution of the target operation can be ended.
[0045] S203, obtaining a plurality of target information from the target matrix and the N target results, and obtaining a target list based on the plurality of target information.
[0046] Wherein, the target list includes a plurality of connection relationships, and one connection relationship is used to indicate the corresponding step length between two network resources having a connection relationship.
[0047] It can be understood that the electronic device can determine two network resources having a connection relationship indicated by each of the at least one second type of numerical value based on the at least one second type of numerical value included in the target matrix, construct a preset list including at least one connection relationship based on the two network resources having a connection relationship indicated by each of the at least one second type of numerical value, then sequentially obtain multiple target information from the N target results, and add multiple connection relationships indicated by the multiple target information to the preset list to obtain a target list.
[0048] Optionally, M1 can be persisted into a relational database to construct a preset list (i.e., Matrix) including at least one connection relationship.
[0049] The present application provides a resource topology sorting method. When it is necessary to perform topology sorting on network resources, a target matrix including three types of numerical values can be constructed based on the connection relationships between multiple network resources, wherein the first type of numerical value indicates that one network resource itself has a connection relationship, the second type of numerical value indicates that the ith network resource has a connection relationship with the jth network resource, and the third type of numerical value indicates that the ith network resource does not have a connection relationship with the jth network resource. Further, N target operations are performed on the target matrix until it is determined from the result obtained from the N+1th target operation that there is no target information indicating that two network resources have a connection relationship, N target results are obtained, and the target operation is ended. Furthermore, multiple target information is obtained from the target matrix and the N target results, and a target list including multiple groups of connection relationships is obtained based on the multiple target information to indicate the corresponding step length between two network resources having a connection relationship. Through the above method, when it is necessary to perform topology sorting on network resources, a target matrix can be constructed based on the connection relationships between multiple network resources, then N target operations are performed on the target matrix to obtain N target results, multiple target information is obtained from the target matrix and the N target results, and a target list is obtained based on the multiple target information. Thus, the problem of complex operation process in topology sorting by a depth or breadth search method of graph theory and the problem of maintaining data consistency in topology sorting by introducing a graph database are solved. Therefore, the efficiency of topology sorting on network resources is improved.
[0050] In one design, as shown in FIG. 1, Figure 3 The resource topology sorting method provided by the embodiment of the present application includes the method in step S201, and specifically includes steps S301-S302:
[0051] S301, constructing a target directed graph based on the connection relationships between multiple network resources.
[0052] The target directed graph includes a plurality of entities and a plurality of directed connection lines, one entity in the plurality of entities is used to indicate one network resource, and one directed connection line in the plurality of directed connection lines is used to indicate a connection relationship between two network resources.
[0053] It can be understood that the target directed graph can be constructed based on the connection relationship between the plurality of network resources.
[0054] As shown in the figure, Figure 4 A schematic diagram of a directed graph is shown. The directed graph includes a point entity No. 1, a point entity No. 2, a point entity No. 3, a point entity No. 4, a point entity No. 5, and a point entity No. 6. Among them, the point entity No. 1 and the point entity No. 2 are connected by a directed connection line C1, the point entity No. 1 and the point entity No. 3 are connected by a directed connection line C2, the point entity No. 2 and the point entity No. 4 are connected by a directed connection line C3, the point entity No. 3 and the point entity No. 5 are connected by a directed connection line C4, and the point entity No. 5 and the point entity No. 6 are connected by a directed connection line C5.
[0055] S302, based on the target directed graph, a connection relationship table is constructed, and a target matrix is constructed through the connection relationship table.
[0056] The connection relationship table is used to indicate the connection relationship between the two network resources corresponding to each directed connection line in the plurality of directed connection lines.
[0057] It can be understood that the target directed graph can be constructed based on the connection relationship between the plurality of network resources.
[0058] Optionally, V in the target directed graph G=(V, E) can be converted into a V set entity (RME_EQP), and then E in the target directed graph G=(V, E) is converted into an E set entity (PUB_LOG_CIRCUIT) based on the V set entity, and the E set entity is converted into an adjacency matrix (i.e. target matrix).
[0059] As an example, the connection relationship table corresponding to the V set entity (RME_EQP) is shown in Table 1:
[0060] Table 1
[0061] EQP ID EQP NAME MAP X MAP Y TYPE 1 Core 1 120.001 29.134 ROUTER 2 Switch 1 120.601 29.034 Switch 3 Switch 2 120.701 29.234 Switch 4 BBU 1 120.801 29.534 BBU 5 BBU 2 120.851 29.234 BBU 6 BBU 3 120.971 29.434 BBU
[0062] The connection relationship table corresponding to the E set entity (PUB_LOG_CIRCUIT) is shown in Table 2:
[0063] Table 2
[0064] CIRCUIT NO A EPQ ID Z EPQ ID VALUE C1 1 2 10G C2 1 3 10G C3 2 4 1G C4 3 5 1G C5 5 6 1G
[0065] As an example, Figure 5As shown in FIG. 1, a schematic diagram of an adjacent matrix M1 is shown. In the adjacent matrix M1, i and j in any one network resource e(i, j) are positive integers greater than or equal to 1 and less than or equal to 6, e(1, 1) is 0, e(1, 2) is 1, e(1, 3) is 1, e(1, 4) is ∞, e(1, 5) is ∞, e(1, 6) is ∞, e(2, 1) is ∞, e(2, 2) is 0, e(2, 3) is ∞, e(2, 4) is 1, e(2, 5) is ∞, e(2, 6) is ∞, e(3, 1) is ∞, e(3, 2) is ∞, e(3, 3) is 0, e(3, 4) is ∞, e(3, 5) is 1, e(3, 6) is ∞, e(4, 1) is ∞, e(4, 2) is ∞, e(4, 3) is ∞, e(4, 4) is 0, e(4, 5) is ∞, e(4, 6) is ∞, e(5, 1) is ∞, e(5, 2) is ∞, e(5, 3) is ∞, e(5, 4) is ∞, e(5, 5) is 0, e(5, 6) is 1, e(6, 1) is ∞, e(6, 2) is ∞, e(6, 3) is ∞, e(6, 4) is ∞, e(6, 5) is ∞, and e(6, 6) is 0.
[0066] In one design, as shown in FIG. 2, the resource topology sorting method provided by the embodiments of the present application includes the following steps S201-S203. Figure 6 As shown in FIG. 2, the method in step S203 includes the following steps S401-S403.
[0067] S401, based on at least one second type of value included in the target matrix, determine two network resources having a connection relationship indicated by each second type of value in the at least one second type of value.
[0068] In one design, one second type of value in the at least one second type of value is a target information.
[0069] It can be understood that the two network resources having a connection relationship indicated by each second type of value in the at least one second type of value can be determined based on the at least one second type of value included in the target matrix.
[0070] S402, based on the two network resources having a connection relationship indicated by each second type of value in the at least one second type of value, construct a preset list including at least one connection relationship.
[0071] It can be understood that the preset list including at least one connection relationship can be constructed based on the two network resources having a connection relationship indicated by each second type of value in the at least one second type of value.
[0072] For example, the preset list corresponding to the adjacent matrix M1 is shown in Table 3.
[0073] Table 3
[0074] A eqp id Z eqp id weight step 1 2 1 1 1 3 1 1 2 4 1 1 3 5 1 1 5 6 1 1
[0075] S403. Sequentially obtain multiple target information from N target results, and add the multiple connection relationships indicated by the multiple target information to a preset list to obtain a target list.
[0076] One of the target results includes at least one target information.
[0077] It is understandable that multiple target information can be obtained sequentially from N target results, and the multiple connection relationships indicated by the multiple target information can be added to a preset list to obtain a target list.
[0078] Optionally, a first target operation (i.e., determining the square root of the target matrix M1) can be performed on the target matrix M1 to obtain the adjacency matrix M2 (i.e., M1*M1). Then, the two network resources (A_eqp_id and Z_eqp_id) with e(i,j)=1 in M2 and their corresponding step sizes are added to the preset list corresponding to M1 to obtain the preset list corresponding to M2. A second target operation (i.e., determining the cubic root of the target matrix M1) is then performed on M2 to obtain M3 (i.e., M1*M2). Finally, the two network resources (A_eqp_id and Z_eqp_id) with e(i,j)=1 in M3 and their corresponding step sizes are added to the preset list corresponding to M2 to obtain the preset list corresponding to M2. The target operation is executed N times sequentially to obtain the target list corresponding to M(N), until the (N+1)th target operation (the (N+1)th power of the target matrix M1 (i.e., e(i, j) in M(N+1) are all not 1), at which point the execution of the target operation ends. The target operation can be executed N times on the target matrix M1 based on a background scheduled task when the background is idle.
[0079] For example, such as Figure 7The diagram illustrates an adjacency matrix M2. In the adjacency matrix M2, i and j in any network resource e(i,j) are positive integers greater than or equal to 1 and less than or equal to 6. e(1,1) is 0, e(1,2) is 0, e(1,3) is 0, e(1,4) is 1, e(1,5) is 1, e(1,6) is ∞, e(2,1) is ∞, e(2,2) is 0, e(2,3) is ∞, e(2,4) is 0, e(2,5) is ∞, e(2,6) is ∞, e(3,1) is ∞, e(3,2) is ∞, e(3,3) is 0, e(3... ,4) is ∞, e(3,5) is 0, e(3,6) is 1, e(4,1) is ∞, e(4,2) is ∞, e(4,3) is ∞, e(4,4) is 0, e(4,5) is ∞, e(4,6) is ∞, e(5,1) is ∞, e(5,2) is ∞, e(5,3) is ∞, e(5,4) is ∞, e(5,5) is 0, e(5,6) is 0, e(6,1) is ∞, e(6,2) is ∞, e(6,3) is ∞, e(6,4) is ∞, e(6,5) is ∞, e(6,6) is 0.
[0080] The preset list corresponding to the adjacent square matrix M2 is shown in Table 4:
[0081] Table 4
[0082] A eqp id Z eqp id weight step 1 2 1 1 1 3 1 1 2 4 1 1 3 5 1 1 5 6 1 1 1 4 1 2 1 5 1 2 3 6 1 2
[0083] like Figure 8 The diagram illustrates an adjacency matrix M3. In the adjacency matrix M3, i and j in any network resource e(i,j) are positive integers greater than or equal to 1 and less than or equal to 6. e(1,1) is 0, e(1,2) is 0, e(1,3) is 0, e(1,4) is 0, e(1,5) is 0, e(1,6) is 1, e(2,1) is ∞, e(2,2) is 0, e(2,3) is ∞, e(2,4) is 0, e(2,5) is ∞, e(2,6) is ∞, e(3,1) is ∞, e(3,2) is ∞, e(3,3) is 0, e(3... ,4) is ∞, e(3,5) is 0, e(3,6) is 0, e(4,1) is ∞, e(4,2) is ∞, e(4,3) is ∞, e(4,4) is 0, e(4,5) is ∞, e(4,6) is ∞, e(5,1) is ∞, e(5,2) is ∞, e(5,3) is ∞, e(5,4) is ∞, e(5,5) is 0, e(5,6) is 0, e(6,1) is ∞, e(6,2) is ∞, e(6,3) is ∞, e(6,4) is ∞, e(6,5) is ∞, e(6,6) is 0.
[0084] The target list corresponding to the adjacent matrix M3 is shown in Table 5:
[0085] Table V
[0086]
[0087]
[0088] In one design, as shown in FIG. 1, the resource topology sorting method provided by the embodiments of the present application includes the following steps: Figure 9 S501:
[0089] S501: When it is needed to determine the network resource having a connection relationship with the target network resource and corresponding step length being less than or equal to the target step length, the required network resource is obtained from the target list through a structured query language (SQL) statement.
[0090] It can be understood that when it is needed to determine the network resource having a connection relationship with the target network resource and corresponding step length being less than or equal to the target step length, the required network resource can be obtained from the target list through a SQL statement.
[0091] Optionally, when it is needed to perform instant topology sorting on the target network resource, the target list (Matrix) corresponding to the target network resource can be subjected to a relationship operation through a SQL statement.
[0092] For example, the target list corresponding to the adjacency matrix M3 can be subjected to a relationship operation, and when selecting the point entity that can be reached by the point entity No. 1 within a step length of 3, the following SQL statement can be used: Select Z_eqp_id, step from Matrix where step<=3, so as to obtain an operation result, and the operation result is shown in Table VI:
[0093] Table VI
[0094] Z eqp id Step 2 1 3 1 4 2 5 2 6 3
[0095] The resource topology sorting method based on a relational database provided by the embodiments of the present application can perform a time complexity and acceptable topology sorting under a relational database, and the cost is only the storage space and the calculation resource in the idle time. The method can convert the topology calculation into algebraic calculation, save the intermediate result of the algebraic calculation in the relational database, and then use the SQL language to retrieve the intermediate result to perform equivalent topology sorting. The relational database is the most common basic software used in the current information system, and has a very wide application basis. The topology sorting realized on the basis of the relational database can use the SQL language to perform data operation, and reduces the complexity of the topology sorting based on the graph theory.
[0096] The foregoing mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, it includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0097] This application embodiment can divide a resource topology sorting method into functional modules based on the above method example. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. Optionally, the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0098] Figure 10 This is a schematic diagram of a resource topology sorting device provided in an embodiment of this application. Figure 10 As shown, a resource topology sorting device 40 is used to improve the efficiency of topology sorting of network resources, for example, for performing... Figure 2 The resource topology sorting method is shown. The resource topology sorting device 40 includes: a processing unit 401 and an acquisition unit 402;
[0099] Processing unit 401 is used to construct a target matrix based on the connection relationship between multiple network resources. The target matrix includes three types of values: the first type of values indicates that a network resource itself has a connection relationship; the second type of values indicates that there is a connection relationship between the i-th network resource and the j-th network resource; and the third type of values indicates that there is no connection relationship between the i-th network resource and the j-th network resource. i and j are both positive integers.
[0100] The processing unit 401 is also used to perform N target operations on the target matrix to obtain N target results, until it is determined from the results obtained from the (N+1)th target operation that there is no target information, and then the execution of the target operation ends; wherein, the Nth target operation is: to determine the (N+1)th power of the target matrix, the target information is used to indicate that there is a connection relationship between two network resources, and N is a positive integer;
[0101] The acquisition unit 402 is configured to acquire a plurality of target information from the target matrix and the N target results, and obtain a target list based on the plurality of target information, the target list including a plurality of connection relationships, and one connection relationship is used to indicate corresponding step lengths between two network resources having a connection relationship.
[0102] In a possible implementation, the processing unit 401 is further configured to construct a target directed graph based on the connection relationships between the plurality of network resources, the target directed graph including a plurality of entities and a plurality of directed connection lines, one entity in the plurality of entities is used to indicate one network resource, and one directed connection line in the plurality of directed connection lines is used to indicate a connection relationship between two network resources; and the processing unit 401 is further configured to construct a connection relationship table based on the target directed graph, and construct the target matrix by using the connection relationship table, the connection relationship table being used to indicate the connection relationship between the two network resources corresponding to each directed connection line in the plurality of directed connection lines.
[0103] In a possible implementation, the resource topology sorting apparatus further includes a determination unit 403; the determination unit 403 is configured to determine, based on at least one second type of value included in the target matrix, two network resources having a connection relationship indicated by each second type of value in the at least one second type of value, one second type of value in the at least one second type of value being one target information; and the processing unit 401 is further configured to construct a preset list including at least one connection relationship based on the two network resources having a connection relationship indicated by each second type of value in the at least one second type of value; the acquisition unit 402 is further configured to acquire the plurality of target information from the N target results in sequence; and the processing unit 401 is further configured to add the plurality of connection relationships indicated by the plurality of target information to the preset list to obtain the target list, and one target result including at least one target information.
[0104] In a possible implementation, the acquisition unit 402 is further configured to acquire, by using a structured query language (SQL) statement, the required network resource from the target list when it is required to determine a network resource having a connection relationship with the target network resource and corresponding step lengths being less than or equal to the target step length.
[0105] In a case where the functions of the above integrated modules are implemented in the form of hardware, the embodiment of the present application provides another possible structural diagram of an electronic device involved in the above embodiment. As shown in Figure 11 An electronic device 60 is configured to improve the efficiency of topology sorting of network resources, for example, used to perform Figure 2 A resource topology sorting method as shown. The electronic device 60 includes a processor 601, a memory 602, and a bus 603. The processor 601 and the memory 602 can be connected by the bus 603.
[0106] The processor 601 is the control center of the communication device, which can be one processor or a general term of multiple processing elements. For example, the processor 601 can be a general central processing unit (CPU), or other general-purpose processors, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0107] As an embodiment, the processor 601 can include one or more CPUs, such as the CPU 0 and the CPU 1 shown in FIG. 6. Figure 11
[0108] The memory 602 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to this.
[0109] As a possible implementation, the memory 602 can exist independently of the processor 601, and the memory 602 can be connected to the processor 601 through the bus 603, for storing instructions or program codes. When the processor 601 invokes and executes the instructions or program codes stored in the memory 602, the resource topology sorting method provided in the embodiments of the present application can be implemented.
[0110] In another possible implementation, the memory 602 can also be integrated with the processor 601.
[0111] The bus 603 can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 11 In FIG. 6, only one thick line is used to represent the bus, but it does not mean that there is only one bus or only one type of bus.
[0112] It should be noted that Figure 11 The illustrated structure does not constitute a limitation on the electronic device 60. In addition to Figure 10 the illustrated components, the electronic device 60 can include more or fewer components than shown, or combine some components, or different component arrangements.
[0113] As an example, in combination with Figure 11 , the functions implemented by the processing unit 401, the acquisition unit 402 and the determination unit 403 in the electronic device are the same as the functions of the processor 601 in Figure 11 .
[0114] Optionally, as indicated, the electronic device 60 provided by the embodiments of the present application can further include a communication interface 604.
[0115] The communication interface 604 is used to connect with other devices through a communication network. The communication network can be an Ethernet, a wireless access network, a wireless local area network (WLAN) and the like. The communication interface 604 can include a receiving unit for receiving data, and a sending unit for sending data.
[0116] In one design, in the electronic device provided by the embodiments of the present application, the communication interface can also be integrated in the processor.
[0117] Through the above description of the implementation, those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of functional units is exemplified. In actual application, the above-mentioned functions can be completed by different functional units according to needs, that is, the internal structure of the device is divided into different functional units to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0118] The embodiments of the present application also provide a computer readable storage medium, which stores instructions, when a computer executes the instructions, the computer executes each step in the method flow shown in the above method embodiments.
[0119] The embodiments of the present application provide a computer program product containing instructions, when the instructions run on a computer, the computer executes a resource topology sorting method in the above method embodiments.
[0120] The computer readable storage medium, for example, can be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), registers, a hard disk, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. The computer readable storage medium can be any tangible medium that is capable of storing programming for use by or in connection with an instruction execution system, apparatus, or device.
[0121] An exemplary storage medium is coupled to the processor such that the processor can read information from, and write information to, the storage medium. Of course, the storage medium can be a part of the processor. The processor and the storage medium can be located in a single device or distributed among multiple devices. The processor can include one or more processors from any combination of
[0122] In the embodiments of the present application, the computer readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus or device.
[0123] Since the electronic device, the computer readable storage medium and the computer program product in the embodiments of the present application can be applied to the above method, the technical effects they can obtain can also be referred to the above method embodiments, and the embodiments of the present application will not be repeated here.
[0124] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto, any change or replacement within the technical scope disclosed in the present application should be covered in the protection scope of the present application.
Claims
1. A method of resource topology sorting, the method comprising: The method comprises: constructing a target directed graph based on the connection relationship between the plurality of network resources, the target directed graph comprising a plurality of entities and a plurality of directed connection lines, one entity in the plurality of entities being used to indicate one network resource, one directed connection line in the plurality of directed connection lines being used to indicate the connection relationship between two network resources; constructing a connection relationship table based on the target directed graph, and constructing a target matrix through the connection relationship table, the connection relationship table being used to indicate the connection relationship between the two network resources corresponding to each directed connection line in the plurality of directed connection lines, the target matrix comprising three types of numerical values; wherein the first type of numerical value represents that one network resource itself has a connection relationship, the second type of numerical value represents that the ith network resource has a connection relationship to the jth network resource, and the third type of numerical value represents that the ith network resource does not have a connection relationship to the jth network resource, i and j being positive integers; performing N times of target operations on the target matrix to obtain N target results, until it is determined that there is no target information in the result obtained from the N+1th target operation, the target operation is ended; wherein the Nth target operation is to determine the N+1th power of the target matrix, the target information is used to indicate that two network resources have a connection relationship, and N is a positive integer; based on at least one second type of numerical value included in the target matrix, determining two network resources having a connection relationship indicated by each second type of numerical value in the at least one second type of numerical value, one second type of numerical value in the at least one second type of numerical value being one target information; based on the two network resources having a connection relationship indicated by each second type of numerical value in the at least one second type of numerical value, constructing a preset list comprising at least one connection relationship; obtaining a plurality of target information from the N target results in turn, and adding a plurality of connection relationships indicated by the plurality of target information to the preset list to obtain a target list, one target result comprising at least one target information, the target list comprising a plurality of groups of connection relationships, and one group of connection relationships being used to indicate the corresponding step length between two network resources having a connection relationship.
2. The method of claim 1, wherein, The method further comprises: when it is required to determine a network resource having a connection relationship with a target network resource and corresponding to a target step length, obtaining the required network resource from the target list through a structured query language (SQL) statement.
3. A resource topology sequencing apparatus, characterized by, The resource topology sorting device comprises a processing unit, a determination unit and an acquisition unit; the processing unit is used to construct a target directed graph based on the connection relationship between the plurality of network resources, the target directed graph comprising a plurality of entities and a plurality of directed connection lines, one entity in the plurality of entities being used to indicate one network resource, one directed connection line in the plurality of directed connection lines being used to indicate the connection relationship between two network resources; The processing unit is further configured to construct a connection relationship table based on the target directed graph, and construct a target matrix based on the connection relationship table, the connection relationship table being configured to indicate a connection relationship between two network resources corresponding to each of the plurality of directed connection lines, the target matrix including three types of numerical values; wherein a first type of numerical value indicates that one network resource has a connection relationship by itself, a second type of numerical value indicates that an ith network resource has a connection relationship with a jth network resource, and a third type of numerical value indicates that the ith network resource does not have a connection relationship with the jth network resource, i and j being positive integers; The processing unit is further configured to perform N times of target operations on the target matrix to obtain N target results, and end the execution of the target operation when it is determined that there is no target information in a result obtained from an (N+1)th target operation; wherein the Nth target operation is to determine an (N+1)th power of the target matrix, the target information is configured to indicate that two network resources have a connection relationship, and N is a positive integer; The determining unit is configured to determine, based on at least one second type of numerical value included in the target matrix, two network resources having a connection relationship indicated by each of the at least one second type of numerical value, one of the at least one second type of numerical value being one target information; The processing unit is further configured to construct a preset list including at least one connection relationship based on the two network resources having a connection relationship indicated by each of the at least one second type of numerical value; The obtaining unit is configured to sequentially obtain a plurality of target information from the N target results; The processing unit is further configured to add a plurality of connection relationships indicated by the plurality of target information to the preset list to obtain a target list, at least one target information being included in one target result, a plurality of groups of connection relationships being included in the target list, and one group of connection relationships being configured to indicate two network resources having a connection relationship and corresponding step lengths.
4. The resource topology sorting apparatus of claim 3, wherein, The obtaining unit is further configured to obtain, from the target list, a network resource required to be determined to have a connection relationship with a target network resource and to have a corresponding step length less than or equal to a target step length, by using a structured query language (SQL) statement.
5. An electronic device, comprising: A device includes: a processor and a memory; wherein the memory is configured to store one or more programs including computer execution instructions, and when the electronic device is running, the processor executes the computer execution instructions stored in the memory to enable the electronic device to perform the resource topology sorting method of any one of claims 1-2.
6. A computer-readable storage medium storing one or more programs, the one or more programs comprising instructions that when executed by a computer cause the computer to perform a method comprising: The one or more programs include instructions that, when executed by a computer, cause the computer to perform the resource topology sorting method of any one of claims 1-2.
Citation Information
Patent Citations
Label switching path active-standby same-route optimization method and label switching path active-standby same-route optimization system
CN112291143A
Mesh network system for short-range radio communication, short-range radio communication method, and short-range radio communication program
JP2017169019A