Node connectivity query method, system, computer device and storage medium

By building the maximum connectivity component and updating the query structure, the problem of low query efficiency when the graph structure is complex is solved, and rapid query connectivity is achieved when the node state changes, reducing query time and resource consumption.

CN114090831BActive Publication Date: 2025-01-10BEIJING ACAD OF ARTIFICIAL INTELLLIGENCE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010855094.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-24
Publication Date
2025-01-10
Estimated Expiration
2040-08-24

AI Technical Summary

Technical Problem

The prior art requires traversing the entire graph structure when querying whether two devices in a network system are connected when the graph structure is complex, resulting in excessive consumption of computer resources and time, and low efficiency when updating the query structure.

Method used

By constructing the maximum connected component based on the XOR value set and the original image edge set, the query structure is updated. When the graph structure changes, the maximum connected component is updated according to the XOR value set and the original image edge set, and the connectivity between two nodes is quickly queried. .

Benefits of technology

When the node state changes, quickly update the query structure, reduce the query time, improve query efficiency, and quickly determine whether the two nodes with open status are connected.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114090831B_ABST
    Figure CN114090831B_ABST
Patent Text Reader

Abstract

The present application provides a node connectivity query method, system, computer device and storage medium, which are applied to a network system built based on a graph structure, wherein the graph structure includes multiple first nodes, multiple second nodes, original graph edges between the first nodes and the second nodes, and original graph edges between the second nodes, and each node can be dynamically closed or opened. The query method includes: updating at least one maximum connected component corresponding to the graph structure before the change according to multiple XOR value sets and original graph edge sets obtained based on the changed graph structure; querying the connectivity of a pair of nodes in an open state according to the at least one maximum connected component obtained by the update. The query method of the present application can quickly update at least one maximum connected component according to the node update and quickly query whether a pair of nodes in an open state are connected according to the at least one maximum connected component after the update.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer data processing, and in particular to a method, system, computer device and storage medium for querying node connectivity. Background Art

[0002] Using graph structures to describe some network systems is beneficial for computer devices to process data. Through the established graph structure, it is possible to query whether any two devices in the open state in the network system are connected.

[0003] However, querying whether two devices in a network system are connected based on a graph structure often requires traversing the entire graph structure. Especially when the graph structure is very complex (for example, there are a large number of devices in the network system, the connection relationship between the devices is complex, etc.), this query method will consume a lot of computer resources and time. Summary of the invention

[0004] In view of the shortcomings of the prior art described above, the purpose of the present application is to provide a node connectivity query method, system, computer device and storage medium, which are used to solve the problems in the prior art of how to quickly update the query structure of query connectivity when the graph structure changes and how to quickly query the connectivity between two nodes.

[0005] To achieve the above-mentioned purpose and other related purposes, the first aspect of the present application provides a node connectivity query method, characterized in that it is applied to a network system constructed based on a graph structure, wherein the graph structure includes multiple first nodes, multiple second nodes, original graph edges between the first nodes and the second nodes, and original graph edges between the second nodes; the query method includes: when the graph structure changes, according to multiple XOR value sets and original graph edge sets obtained based on the changed graph structure, updating at least one maximum connected component corresponding to the graph structure before the change; wherein the XOR value set is obtained based on the graph edges established between any two second nodes connected to the same selected first node, and the original graph edge set includes the original graph edges between the second nodes in an open state; and querying the connectivity of a pair of nodes based on the at least one maximum connected component obtained by the update.

[0006] In certain embodiments of the first aspect of the present application, the multiple XOR value sets are obtained based on multiple set graph edge sets corresponding to the graph structure; wherein the set graph edges in the set graph edge sets are graph edges established between any two second nodes connected to the same selected first node, and the same selected first node is a first node with an open state extracted by a preset probability.

[0007] In certain embodiments of the first aspect of the present application, the XOR value in the XOR value set is the XOR of the identifiers of the set graph edges between a second node whose state is open and other second nodes whose states are open, and the two second nodes of the set graph edges belong to the hierarchical point sets of any two layers.

[0008] In certain embodiments of the first aspect of the present application, a plurality of XOR value sets are used to expand the connected components obtained according to the original graph edge set until a new connected component obtained using the XOR values ​​in the plurality of XOR value sets is the same as the connected component before the expansion, and the same connected component is used as a maximum connected component of the graph structure.

[0009] In certain embodiments of the first aspect of the present application, the query method further includes: when the graph structure completes each set of changes, updating multiple set graph edge sets, multiple XOR value sets and original graph edge sets according to each set of changes in the graph structure; wherein the number of each set of changes is q, q≤p, and p is the number of second nodes in the graph structure.

[0010] In certain embodiments of the first aspect of the present application, in a set of changes in the graph structure, when the state of a first node changes from off to on; based on at least one of a plurality of XOR value sets and an original graph edge set obtained based on the changed graph structure, the step of updating the at least one maximum connected component includes: adding the original graph edge connected to the first node to the original graph edge set to update the original graph edge set; and updating the at least one maximum connected component based on the updated original graph edge set.

[0011] In certain embodiments of the first aspect of the present application, in a set of changes in a graph structure, when the state of a first node changes from on to off, and the state of the first node at the beginning of the set of changes is off or the first node has changed in the set of changes; based on at least one of a plurality of XOR value sets and an original graph edge set obtained based on the changed graph structure, the step of updating the at least one maximum connected component includes: deleting the original graph edge connected to the first node from the original graph edge set to update the original graph edge set; and updating the at least one maximum connected component based on the updated original graph edge set.

[0012] In certain embodiments of the first aspect of the present application, in a set of changes in a graph structure, when the state of a first node changes from on to off for the first time in a set of changes, and the state of the first node at the beginning of the set of changes is on; based on at least one of a plurality of XOR value sets obtained based on the changed graph structure and an original graph edge set, the step of updating the at least one maximum connected component comprises: obtaining a first set corresponding to each layer of hierarchical point sets based on the first node; wherein the first set is the second node connected to the first node in the hierarchical point set; updating a plurality of XOR value sets based on the second node in the obtained first set; and updating the at least one maximum connected component based on the updated plurality of XOR value sets.

[0013] In certain embodiments of the first aspect of the present application, for a set of changes in the graph structure, when the state of a second node changes, the step of updating the at least one maximum connected component according to at least one of the multiple XOR value sets and the original graph edge set obtained based on the changed graph structure includes: updating multiple XOR value sets according to the second node whose state has changed and a first node whose state is on at the beginning of the set of changes and whose state changes from on to off before the state of the second node changes; updating the original graph edge set according to the second node whose state has changed; and updating the at least one maximum connected component according to the updated multiple XOR value sets and the updated original graph edge set.

[0014] In certain implementations of the first aspect of the present application, the graph structure is generated based on the network connection relationship between the terminal equipment and the switching center and the network connection relationship between the switching centers in the communication network system.

[0015] In certain embodiments of the first aspect of the present application, the step of querying the connectivity of a pair of nodes based on at least one updated maximum connected component includes: if the two second nodes belong to the same maximum connected component, determining that the two second nodes are connected; if the two second nodes do not belong to the same maximum connected component, determining that the two second nodes are not connected.

[0016] In certain embodiments of the first aspect of the present application, when a pair of nodes being queried includes a first node, the step of querying the connectivity of a pair of nodes based on at least one updated maximum connected component includes: determining the second node connected to the queried first node based on the original graph edge between the first node in an open state and the second node in an open state in the graph structure; if there is no second node connected to the first node, it is determined to be disconnected; otherwise, querying the connectivity between the two second nodes based on the at least one maximum connected component to determine the connectivity of the pair of nodes.

[0017] The second aspect of the present application also provides a node connectivity query system, which is applied to a network system built based on a graph structure, wherein the graph structure includes multiple first nodes, multiple second nodes, original graph edges between the first nodes and the second nodes, and original graph edges between the second nodes, and the query system includes: a monitoring module, which is used to monitor the graph structure to output change instructions; an update module, which is used to update at least one maximum connected component corresponding to the graph structure before the change when receiving the change instruction, according to multiple XOR value sets and original graph edge sets obtained based on the changed graph structure; wherein the XOR value set is obtained based on the graph edges established between any two second nodes connected to the same selected first node, and the original graph edge set includes the original graph edges between second nodes in an open state; a query module, which is used to query the connectivity of a pair of nodes based on the at least one maximum connected component obtained by the update.

[0018] The third aspect of the present application also provides a computer device, comprising: a storage device for storing a graph structure and at least one maximum connected component corresponding to it, and at least one program; a processing device, connected to the storage device, for executing the at least one program to coordinate the storage device to execute the node connectivity query method as described in any one of the first aspects of the present application.

[0019] The fourth aspect of the present application also provides a computer-readable storage medium storing at least one program, wherein the at least one program is executed and implements the node connectivity query method as described in any one of the first aspects of the present application when called.

[0020] As described above, the node connectivity query method, system, computer device and storage medium of the present application have the following beneficial effects: when the state of a node in a graph structure changes, a query structure for querying connectivity can be quickly obtained, thereby reducing the time for updating the query structure; and whether two nodes in an open state are connected can be quickly queried based on at least one maximum connected component corresponding to the current graph structure, thereby reducing the query time. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 Shown is a schematic diagram of the hardware structure of a computer device in one embodiment of the present application.

[0022] Figure 2 Shown is a schematic diagram of the diagram structure of the present application in one embodiment.

[0023] Figure 3 Shown is a schematic diagram of the diagram structure of the present application in another embodiment.

[0024] Figure 4 Shown is a schematic diagram of an updated diagram structure of the present application in one embodiment.

[0025] Figure 5 Shown is a schematic flow chart of a node connectivity query method of the present application in one embodiment.

[0026] Figure 6a Shown is a schematic diagram of a diagram structure in one embodiment before the update of this application.

[0027] Figure 6b Display as Figure 6a A schematic diagram of an updated graph structure in one embodiment.

[0028] Figure 7a Shown is a schematic diagram of a diagram structure in another embodiment before the update of this application.

[0029] Figure 7b Display as Figure 7a A schematic diagram of an updated graph structure in another embodiment.

[0030] Figure 8a Shown is a schematic diagram of a diagram structure before the update of this application in yet another embodiment.

[0031] Figure 8b Display as Figure 8a A schematic diagram of an updated graph structure in yet another embodiment.

[0032] Figure 8c Display as Figure 8b A schematic diagram of an updated graph structure in one embodiment.

[0033] Fig. 9 A schematic diagram of an embodiment showing an initial graph structure of a set of changes.

[0034] Fig.10 A schematic diagram showing the two largest connected components corresponding to a graph structure.

[0035] Fig.11 Shown is a schematic diagram of the structure of a node connectivity query system in one embodiment of the present application. DETAILED DESCRIPTION

[0036] The following is an explanation of the implementation of the present application by means of specific embodiments. People familiar with the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification.

[0037] In some instances, the terms first, second, etc. are used to describe various elements in this article, but these elements should not be limited by these terms. These terms are only used to distinguish an element from another element. For example, the first node can be referred to as the second node, and similarly, the second node can be referred to as the first node, without departing from the scope of the various described embodiments. The first node and the second node are both describing a node, but unless the context clearly indicates otherwise, they are not the same node.

[0038] Furthermore, as used in this article, the singular forms "one", "an" and "the" are intended to include plural forms as well, unless there is an indication to the contrary in the context. It should be further understood that the terms "comprise", "include" indicate the presence of the described features, steps, operations, elements, components, projects, kinds, and / or groups, but do not exclude the presence, occurrence or addition of one or more other features, steps, operations, elements, components, projects, kinds, and / or groups. The terms "or" and "and / or" used herein are interpreted as inclusive, or mean any one or any combination. Therefore, "A, B or C" or "A, B and / or C" means "any of the following: A; B; C; A and B; A and C; B and C; A, B and C". Exceptions to this definition will only occur when the combination of elements, functions, steps or operations is inherently mutually exclusive in some way.

[0039] In practical applications, a network system can be described by nodes in the network system and the connection relationship between the nodes. The network system includes but is not limited to a communication network system, a transportation network, and the like.

[0040] In the following embodiments, the network system is temporarily taken as a communication network system for illustration, but it is not limited to this. It should be understood that the network system in some examples may also be other network systems that conform to the graph structure described in this application.

[0041] Taking the network system as a communication network system as an example, the communication network system is exemplified by: mobile communication network, Internet, local area network, etc. The nodes in the communication network system are network connection devices, and the network connection devices include a switching center for exchanging information (referred to as the second node in the graph structure), and a terminal device (referred to as the first node in the graph structure), etc. The switching center is exemplified by a router, a switch, a hub, etc., and the terminal device is exemplified by a mobile phone, a computer, a fax machine, a telephone landline, etc. The connection relationship between nodes in the communication network system includes the connection relationship between switching centers and the connection relationship between terminal devices and switching centers.

[0042] The nodes in the above network system and the connection relationship between the nodes can be represented by a graph structure G = (V, E), where V represents the node set of the graph structure, E represents the original graph edge set of the graph structure, the original graph edge represents the connection relationship that actually exists in the network system, and the set graph edge mentioned later is obtained based on the original graph edge, and the set graph edge will be described in detail later. The node set is divided into a first node set L and a second node set U, the first node set L includes the first node in the graph structure (for example, the terminal device in the network system), k = |L|, k is the total number of first nodes in the first node set L. The second node set U includes the second node in the graph structure (for example, the switching center in the network system), p = |U|, p is the total number of second nodes in the second node set U. The original graph edges in the graph edge set E include the original graph edges connecting the first node and the second node, and the original graph edges connecting the second nodes. The original graph edge between the node u and the node v can be represented by (u, v) or (v, u). The original graph edge (u, v) and the original graph edge (v, u) represent the same original graph edge. The set of the second nodes in the second node set U that are open can be represented by U * express.

[0043] It should be noted that the first node or the second node of the original graph edge can be a node in an open state (for example, the terminal device or the switching center is in a state where it can communicate with other nodes) or a node in a closed state (for example, the terminal device or the switching center is in a state where it cannot communicate with other nodes for some reason); specifically, the original graph edge in the graph structure includes: an original graph edge between two nodes in an open state, an original graph edge between two nodes in a closed state, and an original graph edge between a node in a closed state and a node in an open state. Although the network connection devices corresponding to the two nodes in the latter two original graph edges cannot communicate with each other, if the states of the two nodes in the latter two original graph edges are changed to both being open, the network connection devices corresponding to the two nodes can communicate. In the diagrams of the following embodiments, the dotted original graph edge indicates that there is a node in the closed state among the two nodes of the original graph edge, and the dotted node indicates a node in the closed state, the solid node indicates a node in the open state, and the solid original graph edge indicates that the states of the two nodes of the original graph edge are both open.

[0044] In practical applications, in order to query whether two network connection devices in a network system can communicate, it is usually necessary to query through a query structure established based on the current graph structure, and the query structure is exemplified as at least one maximum connected component corresponding to the current graph structure. To this end, the constructed query structure includes not only the original graph edges between all the second nodes in the open state, but also the original graph edges between all the first nodes in the open state and the second nodes in the open state. The number of first nodes k in the graph structure is often large, and the number of second nodes p is often small. For example, p = O(n 0.846 ), where n is the total number of nodes in the graph structure. Therefore, when n is large, directly calculating the maximum connected component based on the graph structure will consume a lot of computer resources and time. And when the graph structure changes (that is, the state of the nodes in the graph structure changes), the amortized update time of updating the query structure directly based on the graph structure is currently the fastest Wherein m is the total number of original graph edges in the original graph edge set E. A large value of m will lead to defects such as slow update time of the query structure, low efficiency of updating the query structure, and large consumption of system resources. The present application uses set graph edges to represent the connectivity of two second nodes caused by the first node, and then only constructs the maximum connected component between the second nodes.

[0045] It should be noted that the number of first nodes and the number of second nodes in the following diagram are only examples. In practical applications, the total number of nodes in the graph structure is often large, and the number of first nodes in the graph structure is greater than the number of second nodes.

[0046] To this end, the present application provides a node connectivity query method, query system, computer device and storage medium, which are applied to a network system built based on a graph structure. At least one maximum connected component can be updated according to the node update, and a pair of nodes in an open state can be queried based on the updated at least one maximum connected component.

[0047] See also Figure 1 , Figure 1 The figure shows a hardware structure diagram of a computer device of the present application in one embodiment. As shown in the figure, the computer device 20 includes a storage device 21 and a processing device 22.

[0048] The storage device 21 is used to store a graph structure and at least one maximum connected component corresponding thereto, and at least one program; the at least one maximum connected component is constructed using multiple XOR value sets and original graph edge sets, and the maximum connected component is used to determine the connectivity between two nodes in an open state; wherein the maximum connected component may include only one second node in an open state in the graph structure, and may also include multiple second nodes in an open state and original graph edges between the second nodes at the same time, and each second node in the same maximum connected component may be directly or indirectly connected (i.e., any two second nodes that can be connected are in the same maximum connected component). In the following examples, for the convenience of exemplification, only the second node included in the maximum connected component is used to represent the maximum connected component, for example, a maximum connected component includes a second node u, a second node r, and an original graph edge between the second node u and the second node r, and for the convenience of exemplification, the point set {u, r} is used to represent the maximum connected component. In some embodiments, the storage device also stores multiple XOR value sets corresponding to the current graph structure, original graph edge sets, multiple set graph edge sets, hierarchical point sets of each layer, and other information that facilitates the execution of connectivity queries.

[0049] The storage device 21 includes, but is not limited to, a read-only memory (ROM), a random access memory (RAM), and a nonvolatile RAM (NVRAM). For example, the storage device 21 includes a flash memory device or other nonvolatile solid-state storage device. In some embodiments, the storage device 21 may also include a memory away from one or more processing devices, for example, a network attached memory accessed via an RF circuit or an external port and a communication network, wherein the communication network may be the Internet, one or more intranets, a local area network (LAN), a wide area network (WAN), a storage area network (SAN), etc., or a suitable combination thereof. The storage device 21 also includes a memory controller, which may control the access control of the computer device such as a central processing unit (CPU) and an interface device or other components to the memory.

[0050] The processing device 22 is connected to the storage device 21, and is used to execute the at least one program to coordinate the storage device 21 to execute the query method of the node connectivity or the update method of the query structure; the processing device 22 includes one or more processors. The processing device 22 can operably perform data reading and writing operations with the storage device 21. The processing device 22 performs such as data compression processing, data encoding, data decoding, etc. The processing device 22 includes one or more general-purpose microprocessors, central processing units (CPUs), one or more application-specific processors (ASICs), one or more digital signal processors (Digital Signal Processors, referred to as DSPs), one or more field programmable gate arrays (Field Programmable Gate Arrays, referred to as FPGAs), or any combination thereof.

[0051] The processing device 22 can also be operably coupled to an interface unit of the computer device 20. Through the interface unit, the computer device 20 can interact with various other electronic devices, and can enable a user to interact with the computer device 20. The interface unit includes a network interface, a data line interface, etc. The network interface includes but is not limited to: an Ethernet network interface, a network interface based on a mobile network (3G, 4G, 5G, etc.), a network interface based on short-range communication (WiFi, Bluetooth, etc.), etc. The data line interface includes but is not limited to: a USB interface, RS232, etc.

[0052] In some embodiments, the computer device 20 further includes an input device (not shown), which enables the user to interact with the computer device 20. The input device includes a button, a keyboard, a mouse, a touchpad, etc. In other embodiments, the computer device 20 may also include an audio unit, which may include a speaker, a pickup, etc. The computer device 20 can interact with the user's voice through the audio unit. In this way, the computer device 20 can obtain a query request through interaction with the user, and the query request will be described in detail later.

[0053] The node connectivity query method provided in the present application is applied to a network system constructed based on a graph structure (i.e., a network system described by a graph structure) and can be executed by the computer device 20 described above or by other computer devices that can execute the relevant steps of the query method.

[0054] The graph structure includes a plurality of first nodes, a plurality of second nodes, original graph edges between the first nodes and the second nodes, and original graph edges between the second nodes.

[0055] See also Figure 2 , Figure 2The diagram shown is a schematic diagram of the diagram structure of the present application in one embodiment, such as Figure 2 As shown, the first nodes in the graph structure are 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, and 16, and the second nodes in the graph structure are 1, 2, 3, and 4. The original graph edges between the first node and the second node in the graph structure include (5, 1), (5, 2), (5, 3), (6, 1), (6, 2), (6, 4), (7, 1), (7, 4), (8, 1), (8, 4), (9, 2), (9, 3), (10, 4), (11, 1), (12, 2), (13, 4), (14, 1), (15, 3), and (16, 3). The original graph edge between two second nodes in the graph structure includes (3, 4), wherein the states of the second node 4 and the first node 5 in the graph structure are off, the dotted original graph edge indicates that there is a node with an off state in the two nodes of the original graph edge, and the solid original graph edge indicates that the states of the two nodes of the original graph edge are both on.

[0056] The XOR value set is obtained according to the set graph edge set corresponding to the graph structure; wherein the set graph edges in the set graph edge set are graph edges established between any two second nodes connected to the same selected first node.

[0057] In one embodiment, the selected same first node is a first node with an open state extracted by a preset probability. Specifically, based on a graph structure and a preset probability, a second set can be obtained by sampling the first node in the graph structure once, and multiple second sets can be obtained by sampling the graph structure multiple times according to the probability, each of which includes part of the first nodes or all of the first nodes, and a set graph edge set F can be obtained according to the first nodes with an open state in each second set; based on a set graph edge set, an XOR value set can be obtained, wherein the XOR value set includes multiple XOR values. An XOR value in the XOR value set is the XOR of the identifier of the set graph edge between a second node with an open state and another second node with an open state, and the two second nodes of the set graph edge belong to the hierarchical point set of any two layers. The preset probability is exemplified as 1 / 2, and the sampling times (the number of second sets, the number of set graph edge sets, and the number of XOR value sets) are exemplified as O(log n), wherein n is the total number of nodes in the graph structure.

[0058] Among them, the corresponding hierarchical point set in the graph structure The third set U i The third set U is composed of points whose states are open. i is based on probability 1 / 2 i The second node set U is sampled, where: p is the total number of second nodes in the second node set U. Figure 2 , when i is equal to 0, the third set U0 corresponding to the graph structure is based on probability 1 / 2 0 The second node set U is obtained by layering, then the third set U0 corresponding to i=0 is (1, 2, 3, 4), and the layered point set corresponding to the third set U0 is is (1, 2, 3).

[0059] In a specific embodiment, please refer to Figure 2 , the second set obtained by sampling the first node set L once with a probability of 1 / 2 is (5, 6, 7, 8, 9, 10), where for the first node 6 in the open state, it is connected to the second nodes 1, 2, and 4, so the set graph edges corresponding to the first node 6 are (1, 2), (2, 4), and (1, 4). For the first node 7 in the open state, it is connected to the second nodes 1 and 4, so the set graph edges corresponding to the first node 7 are (1, 4). For the first node 8 in the open state, it is connected to the second nodes 1 and 4, so the set graph edges corresponding to the first node 8 are The graph edge is set to (1, 4). For the first node 9 in the open state, it is connected to the second nodes 2 and 3, so the graph edge corresponding to the first node 9 is (2, 3). Therefore, the graph edge set corresponding to the second set (5, 6, 7, 8, 9, 10) is {(1, 2), (2, 4), (1, 4), (1, 4), (1, 4), (2, 3)}. Multiple sampling of the first node set L with a probability of 1 / 2 can obtain multiple second sets, and then multiple graph edge sets can be obtained. Based on the multiple graph edge sets, multiple XOR value sets can be obtained. It should be noted that in a group of changes, the multiple graph edge sets after each change remain unchanged, and each graph edge set always represents the connectivity caused by the first node in the open state selected before the group of changes. The multiple graph edge sets only change when the graph structure is updated after a group of changes, but in a group of changes, the XOR value set must be consistent with the current graph structure, which will be described in detail later.

[0060] The XOR value in the XOR value set is the XOR of the identifiers of the set graph edges between a second node in an open state and other second nodes in an open state, and the two second nodes of the set graph edges belong to the hierarchical point sets of any two layers.

[0061] The identifier of the set graph edge is used to distinguish different set graph edges, and the identifier can be composed of the identifiers of two second nodes. For example, the length of the identifier of the second node is binary bits. When the number p of second nodes in the graph structure is 16, the identifier length is 4 binary bits. If the identifiers of second node 0 and second node 1 are 0000 and 0001 respectively, the identifier of the set graph edge formed by these two second nodes can be 00000001. The identifier of the set graph edge can also be 00010000. However, it needs to be consistent during the execution of the entire query method. In subsequent embodiments, the identifier of the set graph edge is formed with the second node with a smaller identifier in front.

[0062] It should be noted that the above method of determining the identifier of the set graph edge formed by two second nodes is only an example. The identifiers of the two second nodes can also be encoded using a preset encoding method to obtain an identifier for uniquely identifying the set graph edge between the two second nodes.

[0063] In a specific embodiment, the XOR value in the XOR value set corresponding to a second node u is in, Where ID(e) represents the identifier of the edge (u, v). Figure 3 , Figure 3 The first nodes in are 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, Figure 3 The second nodes in are 0, 1, 2, 3, and the second set obtained by sampling the first node set L with a probability of 1 / 2 is (4, 5, 6, 7, 8, 9). The set of set graph edges corresponding to the second set (4, 5, 6, 7, 8, 9) is {(0, 1), (1, 3), (0, 3), (0, 3), (0, 3), (1, 2)}. For the second node 1, when i and j take different values, the XOR value set includes multiple XOR values ​​of the second node 1. For example, when i=j=0, the XOR value T 0,0 (1) is the XOR of setting the label of the edge (0, 1), setting the label of the edge (1, 3), and setting the label of the edge (1, 2). 0,0 (1), the identifier of the edge (0, 1) can be 0001, the identifier of the edge (1, 3) can be 0111, and the identifier of the edge (1, 2) can be 0110. Therefore, for the above set of edge sets, when i = j = 0, the XOR value corresponding to the second node 1 is For other XOR values ​​T corresponding to the second node 1 i,j (1) Whether the second node 1 belongs to U i * And whether the other second node in the set graph edge connected to the second node 1 belongs to to calculate.

[0064] The original graph edge set includes the original graph edges between the second nodes in the graph structure that are in an open state. The maximum connected component can be used to represent the connectivity between the second nodes in an open state. The maximum connected component can be composed of the second nodes in an open state. Any two second nodes that can be connected through the first node and the second node in an open state are in the same maximum connected component. Figure 4 , Figure 4 The first nodes in are 6, 7, 8, 9, 10, 11, 12, Figure 4 The second nodes in are 0, 1, 2, 3, 4, 5, Figure 4 The corresponding original graph edge set includes the three original graph edges (0, 1), (2, 3), and (1, 2). Since, Figure 4 The original graph edge set includes: (0, 1), (2, 3), (1, 2), and the second node 3, the second node 4, and the second node 5 are all connected to the first node 6, then the maximum connected component corresponding to the graph structure is {0, 1, 2, 3, 4, 5}. It should be noted that when the graph structure is updated, the original graph edge set may also include the original graph edge between the first node in the open state and the second node in the open state added due to the update.

[0065] See also Figure 5 , Figure 5 The flowchart of the query method of node connectivity of the present application in one embodiment is shown as follows. As shown in the figure, the query method includes step S110 and step S120. The present application can update at least one maximum connected component according to the node update and query whether a pair of nodes in the open state are connected according to the updated at least one maximum connected component; wherein the processing device coordinates the hardware such as the storage device to perform the following steps, and the at least one maximum connected component corresponding to the graph structure before the change is obtained by using multiple XOR value sets corresponding to the graph structure before the change and the original graph edge set.

[0066] In step S110, when the graph structure changes, the at least one maximum connected component is updated according to a plurality of XOR value sets and an original graph edge set obtained based on the changed graph structure.

[0067] When the state of a network connection device in an actual network system may change from on to off or from off to on due to hardware failure, human operation, etc., the corresponding graph structure may change. The changes in the graph structure include: the state of the first node in the graph structure changes from off to on, the state of the first node in the graph structure changes from on to off, the state of the second node in the graph structure changes from off to on, and the state of the second node in the graph structure changes from on to off.

[0068] In an implementation of the present application, in order to ensure the accuracy of the updating method, every q graph structure changes are regarded as a group, where q≤p, and p is the number of second nodes in the graph structure.

[0069] In one embodiment, when the graph structure changes, a maximum connected component is constructed using multiple XOR value sets corresponding to a graph structure and an original graph edge set. If the maximum connected component does not include all second nodes in the graph structure whose states are open, it is necessary to continue to construct other maximum connected components based on the graph structure until at least one of the constructed maximum connected components includes all second nodes in the graph structure whose states are open.

[0070] In a specific embodiment, when the graph structure changes, the connected component set of all the second nodes in the open state formed by the original graph edge set is first updated. In each update, the original graph edge set updates at most p original graph edges, and the time required is For a connected component in the connected component set, multiple XOR value sets are used to gradually expand the connected component until the multiple XOR value sets can no longer expand it. At this time, the connected component obtained is a maximum connected component. For each connected component in the connected component set obtained by updating the original graph edge set, multiple XOR value sets are used to expand it, and at least one maximum connected component corresponding to the graph structure can be obtained.

[0071] Take an original graph edge set including three original graph edges (u, r), (v, w), and (w, e) as an example, where the original graph edge (w, e) is the original graph edge added after the graph structure changes. The connected components where all second nodes in the open state are obtained according to the original graph edge set before the change are: the connected component {u, r} where the second nodes u and r are located, the connected component {m} where the second node m is located, the connected component {e} where the second node e is located, and the connected component {v, w} where the second nodes v and w are located. In the process of updating at least one connected component based on multiple XOR value sets obtained based on the changed graph structure and the original graph edge set, first, the connected components {u, r}, {m}, {e} and {v, w} are updated using the original graph edge set {(u, r), (v, w), (w, e)}, and new connected components {u, r}, {m}, {e} and {v, w, e} obtained using the original graph edge set can be obtained; then, each connected component can be expanded using the multiple XOR value sets obtained based on the changed graph structure. Taking the expansion of the connected component W = {u, r} as an example, the XOR value of the connected component W can be obtained using the XOR values ​​in the multiple XOR value sets corresponding to the second nodes u and r. in, For a pair (i, j), T i,j(W) represents the XOR of the XOR values ​​of all points in the connected component W; if there is a set graph edge (u, m) in the graph structure, then there is a pair (i, j) with constant probability such that T i,j (W) is the label of the edge (u, m) of the graph; if T i,j (W) is the identifier of the edge (u, m), then we can i,j (W) Expand the connected component W to obtain a new connected component M = {u, r, m}, and then use the multiple XOR values ​​in the multiple XOR value sets corresponding to the second nodes u, r, and m to obtain the XOR value of the connected component M. If all T i,j If the set graph edges represented by (M) cannot expand the connected component M, then the connected component M = {u, r, m} is the maximum connected component corresponding to the obtained graph structure. It should be noted that if there is no pair (i, j) such that T i,j (W) is the identifier of the edge (u, r), and the connected component W = {u, r} is the maximum connected component corresponding to the obtained graph structure. In order to make the constant probability approach 1, it is necessary to sample the second node O(log n) times to obtain multiple layers. For each layer All of them perform operations such as XOR value update, at least one maximum connected component update, etc.

[0072] by Figure 4 As an example, Figure 4 The original graph edge set corresponding to the graph structure is {(0, 1), (2, 3), (1, 2)}, wherein the original graph edge (0, 1) is added to the original graph edge set after the state of the second node 0 changes from off to on during the change of the graph structure. Before the change of the graph structure, the connected components of all the second nodes in the on state formed by the original graph edges are {1, 2, 3}, {4}, {5} respectively. The change of the graph structure leads to the change of the original graph edge set. In the process of updating at least one connected component based on the multiple XOR value sets and the original graph edge set obtained based on the changed graph structure, first, the connected component {1, 2, 3} is updated using the original graph edge set {(0, 1), (2, 3), (1, 2)} to obtain a new connected component O = {0, 1, 2, 3}, and then an XOR value T of the connected component O is obtained using the XOR values ​​of the second nodes in the new connected component. i,j (O) = 011100, and then a new connected component P = {0, 1, 2, 3, 4} is obtained. Then, the XOR value of each second node in the connected component P = {0, 1, 2, 3, 4} can be used to obtain an XOR value T of the connected component P. i,j(P) = 100101, and then the connected component P = {0, 1, 2, 3, 4} is expanded to obtain a new connected component Q = {0, 1, 2, 3, 4, 5}. The connected component Q = {0, 1, 2, 3, 4, 5} is expanded again using the XOR value of each second node in the connected component Q = {0, 1, 2, 3, 4, 5} to obtain a connected component that is still Q = {0, 1, 2, 3, 4, 5}, and the connected component is used as a maximum connected component {0, 1, 2, 3, 4, 5} of the graph structure.

[0073] In a set of changes in the graph structure, if the circumstances under which the graph structure changes are different, the specific implementation methods of the corresponding update query structure are also different. Specifically, different changes in the graph structure may cause the original graph edge set to change, multiple XOR value sets to change, or both to change. When the graph structure changes, the processing device uses the implementation method of obtaining the maximum connected component described above based on the changed set and the unchanged set to obtain at least one maximum connected component corresponding to the updated graph structure, and then updates at least one maximum connected component corresponding to the graph structure before the update. For example, before the graph structure changes, it includes the maximum connected component M{0, 1, 2, 3}, and the maximum connected component N{4, 5, 6, 7}. After the graph structure changes, only multiple XOR value sets change, so that there is a pair (i, j) that makes the XOR value of the maximum connected component M Among them, 011 is the identifier of the second node 3, and 100 is the identifier of the second node 4. Therefore, based on the updated multiple XOR value sets and the unchanged original graph edge set, the maximum connected component corresponding to the updated graph structure can be obtained by using the implementation method of obtaining the maximum connected component described above, and the two maximum connected components before the graph structure is updated can be updated with the maximum connected component. For another example, before the graph structure changes, it includes the maximum connected component M{0, 1, 2, 3} and the maximum connected component N{4, 5, 6, 7}. When the graph structure changes, only the original graph edge set changes. The original graph edge set has more graph edges between the first node 8 in the open state and the second node 3 in the open state, and the graph edges between the first node 8 in the open state and the second node 4 in the open state. According to the updated original graph edge set, the at least one maximum connected component is updated, and the maximum connected component corresponding to the updated graph structure can be obtained as 0, 1, 2, 3, 4, 5, 6, 7}.

[0074] The following is an example of an implementation method for updating the at least one maximum connected component based on at least one of the multiple XOR value sets and the original graph edge sets obtained based on the changed graph structure, taking different situations in which the graph structure changes.

[0075] In one example, in a set of changes in a graph structure, when the state of a first node changes from closed to open, the original graph edge connected to the first node is added to the original graph edge set to update the original graph edge set; according to the updated original graph edge set, the at least one maximum connected component is updated. Specifically, when the state of the first node changes from closed to open, the dotted original graph edge of the first node is changed to a solid original graph edge, the solid original graph edge is added to the original graph edge set to obtain an updated original graph edge set, and the processing device updates at least one maximum connected component according to the updated original graph edge set and multiple XOR value sets that have not been updated.

[0076] See also Figure 6a and Figure 6b , Figure 6a The diagram shown is a schematic diagram of a diagram structure in one embodiment before the update of this application. Figure 6b Display as Figure 6a A schematic diagram of an updated graph structure in one embodiment is shown in FIG. Figure 6a and Figure 6b As shown, the graph structure includes 6 first nodes {4, 5, 6, 7, 8, 9} and 4 second nodes {0, 1, 2, 3}. The original graph edge set in the graph structure before updating includes {(0, 1), (2, 3)}. The first node 6 and the second node 1, as well as the first node 6 and the second node 2 in the original graph structure cannot communicate directly. Since the state of the first node 6 in the graph structure changes from off to on, the dashed original graph edges (6, 1), (6, 2) become solid original graph edges (6, 1), (6, 2), that is, the first node 6 and the second node 1, as well as the first node 6 and The second node 2 can communicate directly; under this change in graph structure, the processing device adds the original graph edge (6, 1) and the original graph edge (6, 2) to the original graph edge set to obtain an updated original graph edge set {(0, 1), (2, 3), (6, 1), (6, 2)}; the two maximum connected components corresponding to the graph structure before updating are {0, 1}, {2, 3} respectively, and at least one maximum connected component is recalculated according to the updated original graph edge set and the unupdated XOR value set to update the two maximum connected components, and the updated maximum connected components are {0, 1, 2, 3}.

[0077] In one example, in a set of changes in a graph structure, when the state of a first node changes from on to off, and the state of the first node at the beginning of the set of changes is off or the first node has changed in the set of changes, the original graph edge connected to the first node is deleted from the original graph edge set to update the original graph edge set. It should be noted that the state of the first node at the beginning of the set of changes is off or the first node has changed in the set of changes, which means that the original graph edge of the first node is added to the original graph edge set in the set of changes using the method described above. According to the updated original graph edge set, the at least one maximum connected component is updated. Specifically, when the state of the first node changes from on to off, including the solid line graph edge of the first node changes to the dotted line original graph edge, the changed original graph edge is deleted from the original graph edge set to obtain an updated original graph edge set, and the processing device updates at least one maximum connected component according to the updated original graph edge set and the multiple XOR value sets that have not been updated.

[0078] See also Figure 7a and Figure 7b , Figure 7a It is a schematic diagram of another embodiment of the diagram structure before the update of this application. Figure 7b Display as Figure 7a A schematic diagram of an updated graph structure in another embodiment is shown in FIG. Figure 7a and Figure 7b As shown, the graph structure includes 10 first nodes {4, 5, 6, 7, 8, 9, 10, 11, 12, 13} and 4 second nodes {0, 1, 2, 3}. Figure 7a is the graph structure before the second change in a set of changes (i.e. the graph structure after the first change), Figure 7b is the graph structure after the second change. After the first change, the state of the first node 10 in the graph structure, which was off, becomes on. Then the original graph edges (2, 10) and (3, 10) are added to the original graph edge set. Figure 7b As shown, after the second change, the state of the first node 10 changes from on to off, and the original graph edge set {(0, 1), (1, 2), (2, 10), (3, 10)} corresponding to the first graph structure change is updated to {(0, 1), (1, 2)}, that is, the original graph edge connected to the first node 10 is deleted from the original graph edge set; the maximum connected component corresponding to the second graph structure change is obtained according to the updated original graph edge set to update the maximum connected component {0, 1, 2, 3} corresponding to the first graph structure change. At this time, the graph structure corresponds to two maximum connected components, namely {0, 1, 2} and {3}.

[0079] In one example, in a set of changes in a graph structure, when the state of a first node is the first time in a set of changes that the state of the first node changes from on to off, and the state of the first node at the beginning of the set of changes is on; then a first set corresponding to each layer of hierarchical point sets is obtained based on the first node; wherein the first set is the second node connected to the first node in the hierarchical point set; multiple XOR value sets are updated based on the second node in the obtained first set, and then the at least one maximum connected component is updated based on the updated multiple XOR value sets. Specifically, when the state of a first node w at the beginning of the set of changes is on, after a graph structure change, if the state of the first node w is the first time in a set of changes that the state of the first node w changes from on to off, it may cause the set graph edge related to the first node w to become invalid. Therefore, the present application updates the graph edge according to multiple first sets. The identifiers of two different second nodes in the first set and the XOR values ​​before the update are used to update multiple XOR value sets, wherein the two second nodes may belong to the same first set or may belong to different first sets, A(w) includes the second nodes connected to the first node w, and the first set A i (w) is a hierarchical point set The processing device updates the at least one maximum connected component according to a plurality of XOR value sets obtained based on the changed graph structure and the original graph edge set before the change.

[0080] See also Figure 8a and Figure 8b , Figure 8a The diagram shown is a schematic diagram of a diagram structure before the update of this application in another embodiment, Figure 8b Display as Figure 8a A schematic diagram of an updated graph structure in another embodiment is shown in FIG. Figure 8a and Figure 8b As shown, the graph structure includes 12 first nodes {8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19} and 8 second nodes {0, 1, 2, 3, 4, 5, 6, 7}. Figure 8a is the graph structure before the first change in a set of changes, Figure 8b The graph structure after the first change: after the first change, the state of the first node 14 in the graph structure that is open changes to closed, and the state of the first node 14 before the first change is open, then the first node 14 is obtained according to each layer of the hierarchical point set The corresponding first set The 4-layered point sets corresponding to the graph structure before the change are The graph structure before the change has the second nodes connected to the first node 14 as 0, 1, 2 and 4, that is, A(14) = {0, 1, 2, 4}. The four first sets obtained according to the changed graph structure are respectively in, Represents empty; according to any second node u∈A in the first set i (14) and the second node v∈A j (14) to update the XOR values ​​in the multiple XOR value sets to update the multiple XOR value sets, taking i=j=0 as an example, the updated Updated In order to obtain the updated T in O(1) time 0,0 (2), after calculating the updated T 0,0 (2) Time use To calculate, where When calculating m, firstly, 0, 1, 2, and 4 connected to the first node 14 are sorted from small to large according to the size of the identifier to obtain the first array {000, 001, 010, 100}, and then, according to the identifiers in the array, the XOR values ​​of all identifiers less than 000, the XOR values ​​of all identifiers less than 001, the XOR values ​​of all identifiers less than 010, and the XOR values ​​of all identifiers less than 100 are obtained. Since there is no identifier less than 000 in the array, the XOR value corresponding to 000 is 000; the XOR value of all identifiers less than 001 is 000; the XOR value of all identifiers less than 010 is The XOR value of all flags less than 100 is The four XOR values ​​are obtained according to the corresponding relationship with each second node to obtain the second array {000, 000, 001, 011}. Finally, for each identifier in the first array, the number of identifiers greater than the identifier is calculated to obtain the third array {3, 2, 1, 0}. When calculating the m value corresponding to the second node 2, it is necessary to XOR the identifier 001 in the second array corresponding to the second node 2 with the identifier of the previous second node, that is, Among them, the number 1 is the value corresponding to the second node in the third array, and 1 means that there is 1 identifier after identifier 001 in the first array. When calculating n, three arrays are also required. The first array when calculating n is {000, 001, 010, 100}; the values ​​in the second array when calculating n are: the XOR value of all identifiers greater than 000, the XOR value of all identifiers greater than 001, the XOR value of all identifiers greater than 010, and the XOR value of all identifiers greater than 100, so the second array when calculating n is {111, 110, 100, 000}; the value in the third array when calculating n is the number of identifiers in the first array that is less than each identifier, so the third array when calculating n is {0, 1, 2, 3}; according to the rules for calculating the value of m, the value of n can be obtained, that is, It can be verified that the updated T 0,0(2) = 000111 is indeed mn = 011100 XOR before the update T 0,0 (2) = 011011, and then the processing device can update multiple XOR values ​​according to the identifiers of the second nodes in each first set to update multiple XOR value sets. Examples are not given here one by one. According to the above calculation rules, it can be known that the time required to update multiple XOR value sets is The processing device updates the at least one maximum connected component according to a plurality of XOR value sets obtained based on the changed graph structure and the original graph edge set before the change.

[0081] In one example, for a set of changes in the graph structure, when the state of a second node changes, multiple XOR value sets are updated according to the second node whose state has changed, and the at least one maximum connected component is updated according to the updated multiple XOR value sets and the updated original graph edge set.

[0082] Specifically, when the state of the second node S changes from on to off, and before the state of the second node S changes, there is a first node whose state changes from on to off, and the state of the first node at the beginning of the group of changes is on, but the current state of the first node can be off or on. The processing device determines the second node connected to the second node S through the set graph edge according to the set graph edge set, and updates the XOR value of each of the second nodes according to the real set graph edge between the second node S and each second node. Taking the update of the XOR value of a second node L connected to the second node S through the set graph edge as an example, first, for all the changed first nodes described in this example, determine the first node commonly connected to the second node S and the second node L, and use the number of set graph edges between the second node S and the second node L in the set graph edge set minus the number of set graph edges between the second node S and the second node L obtained by connecting each of the first nodes, so as to obtain the number of real set graph edges between the second node S and the second node L, and then update the XOR value of the second node L connected to the second node S through the set graph edge. When the state of the second node S changes from off to on, and before the state of the second node S changes, there is a first node whose state changes from on to off, and the state of the first node at the beginning of this group of changes is on, but the current state of the first node can be either off or on, the processing device determines the second node connected to the second node S through the setting graph edge according to the setting graph edge set, and updates the XOR value of each second node according to the real setting graph edge between the second node S and each second node. Taking updating the XOR value of a second node L connected to the second node S through a set graph edge as an example, first, for all the changed first nodes described in the example, determine the first node commonly connected to the second node S and the second node L, and subtract the number of set graph edges between the second node S and the second node L obtained by connecting the first nodes in the set graph edge set from the number of set graph edges between the second node S and the second node L, so as to obtain the number of real set graph edges between the second node S and the second node L, and then update the XOR value of the second node S and the second node L connected to the second node S through the set graph edge in an open state, wherein the XOR value of the second node S is the XOR value of the identifiers of all real set graph edges corresponding to the second node S. In this embodiment, taking updating the XOR value of L as an example, the updated XOR value of the second node L is the XOR of the XOR value of the second node L before the update and the identifier of the real set graph edge between the second node L and the second node S. If there are two real set graph edges, the XOR value of the second node L before the update is XORed with the identifiers of the set graph edges between the two second nodes L and the second node S. Since there are at most q first nodes mentioned above, the time required for updating in this case is

[0083] For example, the state of a second node changes from on to off. Figure 8c , Figure 8c Display as Figure 8b A schematic diagram of an updated graph structure in one embodiment, wherein: Figure 8a is the graph structure before the first change in a set of changes, Figure 8b The graph structure after the first change (i.e., the graph structure before the second change), since the state of the first node 14 changes from on to off during the first change, the second nodes connected to the first node 14 together with the second node 4 in the graph are second nodes 0, 1, and 2. Therefore, it is necessary to obtain the real set graph edge between the second node 4 and the second node 0, the real set graph edge between the second node 4 and the second node 1, and the real set graph edge between the second node 4 and the second node 2 based on the changed second node 4. Specifically, the set graph edge set includes 1 set graph edge between the second node 4 and the second node 0, minus 1 set graph edge that fails due to the first node 14, and the number of real set graph edges between the second node 4 and the second node 0 after the change is 0; the set graph edge set includes 1 set graph edge between the second node 4 and the second node 1, minus 1 set graph edge that fails due to the first node 14, and the number of real set graph edges between the second node 4 and the second node 1 after the change is 0; the set graph edge set includes 2 set graph edges between the second node 4 and the second node 2, minus 1 set graph edge that fails due to the first node 14, and the number of real set graph edges between the second node 4 and the second node 2 after the change is 1. The processing device updates the XOR values ​​of the second node 0, the second node 1, the second node 2, and the second node 3 respectively according to the real set graph edges to update multiple XOR value sets. Taking the updating of the XOR value of the second node 2 as an example, the XOR value of the updated second node 2 is the XOR of the XOR value of the second node 2 before the update and the identifier of the real set graph edge between the second node 2 and the second node 4. The number of real set graph edges between the second node 2 and the second node 4 is 1, so the XOR value of the updated second node 2 is the XOR value of the second node 2 before the update or the identifier of the set graph edge between the last second node 2 and the second node 4. The processing device can update the at least one maximum connected component according to the updated multiple XOR value sets and the original graph edge set that has not been updated.

[0084] It should be noted that, for a group of changes in the graph structure, when the state of a second node changes, and before the state of the second node changes, there is no situation where the state of the first node changes from on to off and the state of the first node is on at the beginning of the group of changes, the processing device directly updates the changed second node and the multiple XOR values ​​of the second nodes connected to the node in the on state and updates the original graph edge set, and then updates the at least one maximum connected component according to the updated multiple XOR value sets and the updated original graph edge set. Take the case where the change is the first change in a group of changes as an example, for example, see Fig. 9 , Fig. 9 It is a schematic diagram showing a group of initial graph structures in one embodiment of a change, Fig. 9 The first nodes in are 4, 5, 6, 7, 8, 9, Fig. 9 The second nodes in the graph are 0, 1, 2, and 3. If the state of the second node 3 in the graph structure changes from on to off after the first change, it is necessary to update the XOR values ​​in the XOR value set corresponding to the second node 0 and the second node 2 respectively, and delete the original graph edge (2, 3) in the original graph edge set; taking the update of the XOR value of the second node 0 as an example, the state change of the second node 3 to off causes the two set graph edges between the second node 3 and the second node 0 to become invalid, so the updated XOR value of the second node 0 is the XOR value before the second node 0 is updated or the identifier of the set graph edge between the previous two second nodes 3 and the second node 0. If the state of the second node 1 in the graph structure changes from off to on after the first change, it is necessary to update the XOR values ​​in the XOR value sets corresponding to the second node 3, the second node 2, the second node 1 and the second node 0 respectively, and add the original graph edge (0, 1) and the original graph edge (1, 2) to the original graph edge set; taking the update of the XOR value of the second node 3 as an example, the state change of the second node 1 causes an invalid set graph edge between the second node 1 and the second node 3 to become valid, so the updated XOR value of the second node 3 is the XOR value before the second node 3 is updated or the identifier of the set graph edge between the previous second node 1 and the second node 3.

[0085] In some embodiments, the query method further includes step S111, in which: when the graph structure completes each group of changes, the processing device updates multiple set graph edge sets, multiple XOR value sets, and original graph edge sets according to each group of graph structure changes, wherein the number of changes in each group is q, q≤p, and p is the number of second nodes in the graph structure. For example, if q is 8, then after the graph structure changes 8 times, the multiple set graph edge sets, original graph edge sets, and multiple XOR value sets after the 8th change are also updated according to the current graph structure and the graph structure before the group of changes. For example, multiple set graph edge sets can be updated according to rectangular matrix multiplication.

[0086] It should be noted that the total update time required for performing a set of updates according to the method described in this application is at most Among them, when the graph structure completes each set of changes, the time required to update multiple set graph edge sets according to the current graph structure is M(p,q,p), where M(p,q,p) refers to the time required to multiply a p×q matrix by a q×p matrix; the time required to update multiple XOR value sets according to the current graph structure is Each update takes up to The longest time required for q updates is Where p is the total number of second nodes in the graph structure, and q is the number of graph structure changes. When q = p 0.575 In the case of In this application The time represents the coefficient of the polynomial that is more than O() time multiplied by one log n.

[0087] In step S120, the processing device queries the connectivity of a pair of nodes according to the updated at least one maximum connected component.

[0088] In some embodiments, the processing device obtains a query request including a pair of nodes, and queries the connectivity of the pair of nodes according to the at least one maximum connected component obtained by updating. The query request is a request for querying whether a pair of two nodes in an open state are connected. The pair of nodes can be any two nodes in an open state in a graph structure.

[0089] The query request may be obtained by the processing device based on the user triggering the input device. For example, the user of the terminal device in the communication network system inputs the query request including a pair of nodes through the input device in order to detect the network connection status of the terminal device he owns; for another example, the staff who maintains the communication network system inputs the query request including a pair of nodes through the input device. The query request may also be automatically generated by the processing device. Specifically, after the graph structure is updated, the processing device automatically generates a query request including a pair of nodes in the open state based on the current graph structure in order to show the user of the terminal device or the manager of the exchange center whether the corresponding devices are connected; for example, in order to reply to a terminal device whether it is connected to the exchange center in the network system, the processing device automatically generates t query requests based on the current graph structure, where t is the total number of second nodes in the open state in the current graph structure.

[0090] Specifically, when the pair of nodes includes the first node and does not include the first node, the manner of determining the connectivity between the two queried second nodes according to the at least one maximum connected component is different, and different queries are respectively described with examples below.

[0091] When the queried pair of nodes includes two second nodes, if the two second nodes belong to the same maximum connected component, it is determined that the two second nodes are connected; if the two second nodes do not belong to the same maximum connected component, it is determined that the two second nodes are not connected.

[0092] In one embodiment, each maximum connected component corresponding to the graph structure has an identifier of a maximum connected component, and the identifier may be the identifier of any second node in the maximum connected component. When the identifiers of the maximum connected components corresponding to two second nodes are the same, it can be determined that the two second nodes belong to the same maximum connected component, and the two second nodes are connected. Otherwise, the two second nodes are not connected. For example, refer to Fig.10 , Fig.10 It shows a schematic diagram of the two largest connected components corresponding to a graph structure. Fig.10 The first nodes in are 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, Fig.10 The second node in is 0, 1, 2, 3, 4, 5, 6, 7. If the pair of nodes includes the second node 1 and the second node 4, the identifier of the maximum connected component A corresponding to the second node 1 is 000, and the identifier of the maximum connected component A corresponding to the second node 4 is also 000, it can be determined that the two second nodes are connected; if the pair of nodes includes the second node 1 and the second node 6, the identifier of the maximum connected component B corresponding to the second node 1 is 000, and the identifier of the maximum connected component B corresponding to the second node 6 is 110, it can be determined that the two second nodes are not connected.

[0093] When the queried pair of nodes includes a first node, the second node connected to the queried first node is determined according to the original graph edge between the first node in an open state and the second node in an open state in the graph structure; if there is no second node connected to the first node, it is determined to be disconnected; otherwise, the second node connected to the first node is arbitrarily selected to replace the queried first node, and then the connectivity between the two second nodes is queried according to the at least one maximum connected component to determine the connectivity of the pair of nodes.

[0094] In one embodiment, when a pair of nodes to be queried includes a first node, it is determined whether there is a second node in the graph structure connected to the first node in an open state. If there is no second node in the graph structure connected to the first node in an open state, it is determined that the pair of nodes is disconnected; if there is a second node in the graph structure connected to the first node in an open state, it is determined whether the second node is connected to the second node in the pair of nodes according to the method in the aforementioned embodiment. If the two second nodes are connected, the pair of nodes to be queried is connected, otherwise, the pair of nodes to be queried is disconnected. When the pair of nodes to be queried includes two first nodes, it can be determined whether there are two second nodes in the graph structure connected to the two first nodes in an open state. If there is a first node, so that there is no second node in the graph structure connected to the first node in an open state, it can be determined that the pair of nodes to be queried is disconnected; if both first nodes have a second node in an open state connected to them, the connectivity between the two second nodes can be determined according to the method in the aforementioned embodiment, and then the connectivity between the pair of nodes to be queried is determined. The query time required to query the connectivity between a pair of nodes is O(p).

[0095] For example, the pair of nodes includes a first node. Fig.10 If the queried pair of nodes includes the second node 1 and the first node 8, the first node 8 is connected to the second node 6 in the open state, the identifier of the maximum connected component B corresponding to the second node 6 is 110, and the identifier of the maximum connected component A corresponding to the second node 1 is 000, then it can be determined that the second node 6 is not connected to the second node 1, and further determine that the second node 1 and the first node 8 in the pair of nodes are not connected. If the pair of nodes includes the second node 2 and the first node 9, the first node 9 is connected to the second node 7 in the closed state, and is not connected to any second node in the open state, then the second node 2 and the first node 9 are not connected. If the pair of nodes includes the second node 2 and the first node 10, the first node 10 is connected to the second node 0 in the open state, the identifier of the maximum connected component A corresponding to the second node 0 is 000, and the identifier of the maximum connected component A corresponding to the second node 2 is also 000, then the second node 2 and the first node 10 are connected.

[0096] In one embodiment, the graph structure is generated based on the network connection relationship between the terminal device and the switching center and the network connection relationship between the switching centers in the communication network system. The terminal device corresponds to the first node in the graph structure, the switching center corresponds to the second node in the graph structure, and each network connection relationship corresponds to the original graph edge in the graph structure. Among them, the network connection relationship between the terminal device and the switching center includes: the network connection relationship between the terminal device in the open state and the switching center in the open state (that is, the connection relationship between the terminal device and the switching center that can communicate with each other), the network connection relationship between the terminal device in the closed state and the switching center in the open state, the network connection relationship between the terminal device in the open state and the switching center in the closed state, and the network connection relationship between the terminal device in the closed state and the switching center in the closed state, that is, the nodes in the original graph edge include not only the nodes in the open state but also the nodes in the closed state; the network connection relationship between the switching centers is similar to the network connection relationship between the terminal device and the switching center, and can also include the connection relationship between the switching centers in the closed state. When the graph structure changes, if it is necessary to query whether the network connection devices in the communication network system (for example, two switching centers with an open status, two terminal devices with an open status, a terminal device with an open status and a switching center with an open status) are connected, the query structure can be updated first through the node connectivity query method described in the present application, and then the updated query structure can be used to query the connectivity between the network connection devices.

[0097] The number of first nodes of the graph structure described in the present application is greater than the number of second nodes (for example, the number of second nodes p=O(n 0.846 ), where n is the total number of all nodes in the graph structure), and the at least one maximum connected component described in the present application is constructed by multiple XOR value sets and the original graph edge set, and the query time for querying whether a pair of nodes in the graph structure is connected based on the updated at least one maximum connected query is at most O(p), where p is the total number of second nodes in the graph structure.

[0098] See also Fig.11 , Fig.11 Shown is a structural schematic diagram of a node connectivity query system of the present application in one embodiment, wherein the query system is applied to a network system constructed based on a graph structure, wherein the graph structure includes multiple first nodes, multiple second nodes, original graph edges between the first nodes and the second nodes, and original graph edges between the second nodes; the query system 40 includes a monitoring module 41, an update module 42, and a query module 43.

[0099] The monitoring module 41 is used to monitor the graph structure to output a change instruction. When the graph structure changes, the monitoring module 41 outputs a change instruction. The change instruction includes: the content of the node status change in the graph structure. Figure 8c For example, the state of the second node 4 in the graph changes from on to off. The change instruction includes: the second change of the graph structure is the state of the second node 4 changes from on to off. In some embodiments, the change instruction also includes the content of the first change of the graph structure.

[0100] The update module 42 is used to update the at least one maximum connected component according to at least one of the multiple XOR value sets and the original graph edge set obtained based on the changed graph structure when receiving the change instruction; wherein the XOR value set is obtained based on the graph edges established between any two second nodes connected to the same selected first node, and the original graph edge set includes the original graph edges between the second nodes whose state is open.

[0101] The query module 43 is used to query the connectivity of a pair of nodes according to the updated at least one maximum connected component. The implementation method of the query module 43 to determine a pair of nodes to be queried is the same or similar to that described above, and will not be repeated here.

[0102] The monitoring module 41 , the updating module 42 , and the query module 43 in the query system 40 cooperate to perform the aforementioned steps S110 and S120 according to the functions of the modules described above, which will not be described in detail here.

[0103] The present application also provides a computer-readable and writable storage medium storing at least one program, which executes and implements the above-mentioned Figure 5 At least one embodiment of the node connectivity query method shown is described.

[0104] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a computer device equipped with the storage medium to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0105] In the embodiments provided in the present application, the computer readable and writable storage medium may include a read-only memory, a random access memory, an EEPROM, a CD-ROM or other optical disk storage device, a disk storage device or other magnetic storage device, a flash memory, a USB flash drive, a mobile hard disk, or any other medium that can be used to store a desired program code in the form of an instruction or data structure and can be accessed by a computer. In addition, any connection can be appropriately referred to as a computer-readable medium. For example, if the instruction is sent from a website, a server or other remote source using a coaxial cable, an optical fiber cable, a twisted pair, a digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwaves, the coaxial cable, optical fiber cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwaves are included in the definition of the medium. However, it should be understood that computer readable and writable storage media and data storage media do not include connections, carriers, signals, or other temporary media, but are intended to be non-temporary, tangible storage media. Disk and disc, as used in this application, includes compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers.

[0106] In one or more exemplary aspects, the functions described by the computer program of the method described in the present application can be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, these functions can be stored or transmitted as one or more instructions or codes on a computer-readable medium. The steps of the method or algorithm disclosed in the present application can be embodied in a processor-executable software module, wherein the processor-executable software module can be located on a tangible, non-temporary computer-readable and writable storage medium. A tangible, non-temporary computer-readable and writable storage medium can be any available medium that a computer can access.

[0107] The flow chart and block diagram in the above-mentioned accompanying drawings of the present application illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. Based on this, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be realized by a dedicated hardware-based system that performs a specified function or operation, or can be realized by a combination of dedicated hardware and computer instructions.

[0108] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.

Claims

1. A method for querying node connectivity, characterized in that: Applied to a network system constructed based on a graph structure, wherein the graph structure includes a plurality of first nodes, a plurality of second nodes, original graph edges between the first nodes and the second nodes, and original graph edges between the second nodes; the query method includes: When the graph structure changes, at least one maximum connected component corresponding to the graph structure before the change is updated according to a plurality of XOR value sets and an original graph edge set obtained based on the changed graph structure; wherein the XOR value set is obtained based on graph edges established between any two second nodes connected to the same selected first node, and the original graph edge set includes original graph edges between second nodes in an open state; wherein the plurality of XOR value sets are obtained based on a plurality of set graph edge sets corresponding to the graph structure; the set graph edges in the set graph edge set are graph edges established between any two second nodes connected to the same selected first node, and the same selected A first node is a first node in an open state extracted by a preset probability; the XOR value in the XOR value set is the XOR of the identifier of a set graph edge between a second node in an open state and other second nodes in an open state, and the two second nodes of the set graph edge belong to the hierarchical point sets of any two layers; the step of constructing a maximum connected component using multiple XOR value sets and the original graph edge set includes: using multiple XOR value sets to expand the connected component obtained according to the original graph edge set until the new connected component obtained by using the XOR values ​​in the multiple XOR value sets is the same as the connected component before the expansion, and the same connected component is used as a maximum connected component of the graph structure; The connectivity of a pair of nodes is queried according to the updated at least one maximum connected component.

2. The node connectivity query method according to claim 1, characterized in that: The query method further includes: When the graph structure completes each group of changes, multiple set graph edge sets, multiple XOR value sets, and original graph edge sets are updated according to each group of graph structure changes; wherein the number of changes in each group is q, q p, p is the number of second nodes in the graph structure.

3. The node connectivity query method according to claim 1, characterized in that: In a set of changes in the graph structure, when the state of a first node changes from off to on; the step of updating the at least one maximum connected component according to at least one of a plurality of XOR value sets obtained based on the changed graph structure and an original graph edge set comprises: Adding the original graph edge connected to the first node to the original graph edge set to update the original graph edge set; The at least one maximum connected component is updated according to the updated original graph edge set.

4. The node connectivity query method according to claim 1, characterized in that: In a set of changes in the graph structure, when the state of a first node changes from on to off, and the state of the first node at the beginning of the set of changes is off or the first node has changed in the set of changes; according to at least one of a plurality of XOR value sets and an original graph edge set obtained based on the changed graph structure, the step of updating the at least one maximum connected component comprises: Deleting the original graph edge connected to the first node from the original graph edge set to update the original graph edge set; The at least one maximum connected component is updated according to the updated original graph edge set.

5. The node connectivity query method according to claim 1, characterized in that: In a set of changes in a graph structure, when the state of a first node changes from on to off for the first time in the set of changes, and the state of the first node at the beginning of the set of changes is on; The step of updating the at least one maximum connected component according to at least one of the multiple XOR value sets obtained based on the changed graph structure and the original graph edge set comprises: According to the first node, a first set corresponding to each layer of hierarchical point set is obtained; wherein the first set is a second node in the hierarchical point set connected to the first node; Update multiple XOR value sets according to the obtained second node in the first set; The at least one maximum connected component is updated according to the updated multiple XOR value sets.

6. The node connectivity query method according to claim 1, characterized in that: For a set of changes in the graph structure, when the state of a second node changes, the step of updating the at least one maximum connected component according to at least one of a plurality of XOR value sets obtained based on the changed graph structure and the original graph edge set includes: updating a plurality of XOR value sets according to a second node whose state is changed and a first node whose state is on at the beginning of the group change and whose state changes from on to off before the state of the second node is changed; Update the original graph edge set according to the second node whose state has changed; The at least one maximum connected component is updated according to the updated multiple XOR value sets and the updated original graph edge set.

7. The node connectivity query method according to claim 1, characterized in that: The graph structure is generated based on the network connection relationship between the terminal equipment and the switching center and the network connection relationship between the switching centers in the communication network system.

8. The node connectivity query method according to claim 1, characterized in that: The step of querying the connectivity of a pair of nodes according to the updated at least one maximum connected component comprises: If the two second nodes belong to the same maximum connected component, determining that the two second nodes are connected; If the two second nodes do not belong to the same maximum connected component, it is determined that the two second nodes are not connected.

9. The node connectivity query method according to claim 1, characterized in that: When the queried pair of nodes includes the first node, the step of querying connectivity of the pair of nodes according to the updated at least one maximum connected component includes: Determine the second node connected to the queried first node based on the original graph edge between the first node in the open state and the second node in the open state in the graph structure; if there is no second node connected to the first node, it is determined to be disconnected; otherwise, query the connectivity between the two second nodes based on the at least one maximum connected component to determine the connectivity of the pair of nodes.

10. A node connectivity query system, characterized in that: Applied to a network system constructed based on a graph structure, wherein the graph structure includes a plurality of first nodes, a plurality of second nodes, original graph edges between the first nodes and the second nodes, and original graph edges between the second nodes, the query system includes: A monitoring module, used for monitoring the graph structure to output a change instruction; An update module is used to update at least one maximum connected component corresponding to the graph structure before the change according to a plurality of XOR value sets and an original graph edge set obtained based on the changed graph structure when receiving the change instruction; wherein the XOR value set is obtained based on the graph edges established between any two second nodes connected to the same selected first node, and the original graph edge set includes the original graph edges between the second nodes in an open state; wherein the plurality of XOR value sets are obtained based on a plurality of set graph edge sets corresponding to the graph structure; the set graph edges in the set graph edge set are graph edges established between any two second nodes connected to the same selected first node, and the selected The same first node is a first node in an open state extracted by a preset probability; the XOR value in the XOR value set is the XOR of the identifier of a set graph edge between a second node in an open state and other second nodes in an open state, and the two second nodes of the set graph edge belong to the hierarchical point sets of any two layers; the step of constructing a maximum connected component using multiple XOR value sets and the original graph edge set includes: using multiple XOR value sets to expand the connected component obtained according to the original graph edge set until the new connected component obtained by using the XOR values ​​in the multiple XOR value sets is the same as the connected component before the expansion, and the same connected component is used as a maximum connected component of the graph structure; The query module is used to query the connectivity of a pair of nodes according to the at least one updated maximum connected component.

11. A computer device, characterized in that: include: A storage device, used for storing a graph structure and at least one maximum connected component corresponding thereto, and at least one program; A processing device is connected to the storage device and is used to execute the at least one program to coordinate the storage device to execute the node connectivity query method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: At least one program is stored, and when the at least one program is called, it is executed and implements the node connectivity query method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Graph database-based power grid equipment reachability query method and system

    CN107679107A

  • Topological structure generation method and system, topological structure updating method and system and storage medium

    CN110941886A