Method and equipment for updating and maintaining key nodes in complex network
By dynamically maintaining the deep-first search spanning tree and node information in complex networks and updating the cut point set, the problem of cutting point state changes caused by dynamic changes is solved, and the stability and performance of the network are improved.
Patent Information
- Application Number
- CN202510050751.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-01-13
AI Technical Summary
In complex networks, dynamic changes lead to changes in cutting point states, and the prior art requires repeated calculations of the entire graph, waste of resources and low performance.
By dynamically maintaining the depth-first search spanning tree and node information, the cutting point set is updated using the idea of the Tarjan algorithm, and only the changing nodes and edges are calculated to avoid repeated calculations.
Improves network stability, reliability and energy efficiency, significantly improves the update performance of cut point sets in dynamic graphs, and avoids waste of resources and increase in computing time.
Smart Images

Figure CN119946764A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of wireless communication, and specifically relates to a method and device for updating and maintaining key nodes in a complex network. The method is applicable to large-scale complex networks and solves the problem of how to update key nodes in a dynamically changing complex network. Background Art
[0002] In recent years, the concept of complex networks has attracted much attention. In daily life, networks are often subject to potential attacks or failures, leading to system crashes and loss of control. For example, when a traffic network is attacked or fails, it will cause node failures, resulting in large-scale traffic paralysis; Internet node failures or edge failures will cause Internet paralysis; power network failures will cause large-scale power outages and other accidents. This shows that network failures can have a significant impact on production and life. Therefore, it is necessary to identify, update and maintain key nodes in the ever-changing complex networks in life.
[0003] A cut point is a type of node in a network. If a cut point is attacked or deleted due to a fault, the network connection will be interrupted. This type of node plays a vital role in ensuring the connectivity of many real-world networks, such as infrastructure networks, protein interaction networks, and terrorist communication networks. However, networks in real life are in a state of constant change, corresponding to the continuous evolution of dynamic graphs. When a node or edge changes in the graph, the state of the cut point will also change. The original cut point may become a non-cut point, and the original non-cut point may also become a cut point. In this case, the traditional cut point calculation method will repeatedly use the Tarjan algorithm to judge the cut points for all nodes in the new graph. However, this method has a lot of unnecessary repeated calculations and wastes resources.
[0004] The difficulty in this processing method is how to determine which nodes may have a change in the state of the cut point when a node or edge changes in the dynamic graph, and thus need to be re-evaluated. The present invention conducts a detailed study on this issue and divides the dynamic graph into different situations for discussion. Summary of the invention
[0005] The purpose of the present invention is to address the above-mentioned problems in the prior art and to provide a method and device for updating and maintaining key nodes in a complex network. The present invention effectively identifies key nodes in the network in real time, thereby improving the stability, reliability and energy efficiency of the network.
[0006] The above-mentioned purpose of the present invention is achieved by the following technical means:
[0007] A method for updating and maintaining key nodes in a complex network includes the steps of updating and maintaining a cut point set in a subgraph where the node is deleted. The steps of updating and maintaining a cut point set in a subgraph where the node is deleted include:
[0008] Step 1a: Perform a depth-first search traversal on the original graph and initialize the original graph as a DFS tree T(r), where r is the root node of the entire DFS tree. Use the Tarjan algorithm to obtain the initial cut point set Cuts and non-cut point set NonCuts of the original graph, and record the information of each node, including the depth, parent node pointer, lowest back edge pointer to_lowest, open state, and refresh state.
[0009] Step 2a: Randomly select a node v from the non-cut point set NonCuts and delete it from the original graph to obtain the subgraph G of the original graph. - , set the open state of node v to false, delete node v from the child node list of the parent node of node v, and then set the parent node pointer of node v to null;
[0010] Step 3a: For all subtrees of the deleted node v, reset the information of all nodes in the subtree, and return the lowest back edge back_connection and the new root node new_sub_root of each subtree connected to the DFS tree;
[0011] Step 4a, point the parent node pointer of the new root node new_sub_root to the corresponding lowest back edge back_connection, add the new root node new_sub_root to the child node list of the lowest back edge back_connection, and set the depth of the new root node new_sub_root to the depth of the lowest back edge back_connection + 1;
[0012] Step 5a: For the subtree in step 3a, use the returned new root node new_sub_root as the new root node, rebuild the subtree based on the new root node through recursive DFS, and update the cut point set in the subtree in the process;
[0013] Step 6a, select the node with the smallest depth in the lowest back edge back_connection corresponding to all subtrees, record it as node lowest_connection_node, and set the refresh status of all nodes on the path (lowest_connection_node,v) from node lowest_connection_node to the deleted node v to false;
[0014] Step 7a, repair the lowest back-edge pointer of the nodes below the node lowest_connection_node in the DFS tree, and update the cut point set;
[0015] Step 8a: The cut point set consisting of all nodes whose cut point states are marked as true is the cut point set after the subgraph of the original graph with the nodes deleted is updated.
[0016] Step 3a as described above includes the following steps:
[0017] Step 3.1a, for each subtree, build a node stack to store all the nodes in the subtree. The top node of the stack is the old root node of the subtree. Start accessing the nodes in the stack from the top node. After each node is accessed, it is popped out of the stack. Node is used to refer to the currently visited node. The depth parameter bar_depth is initialized to store the depth of the currently visited node node. Go to step 3.2a.
[0018] Step 3.2a, traverse the adjacent points of the adjacency list of the currently visited node node. If the depth of the adjacent point u_node in the adjacency list of the currently visited node node is less than the depth parameter bar_depth, then update the depth parameter bar_depth, and set the depth parameter bar_depth equal to the depth of the adjacent point u_node of the currently visited node node. The new root node new_sub_root is the currently visited node node, and the lowest back edge back_connection is the adjacent point u_node of the currently visited node node. Reset the depth of the currently visited node node to -1, reset the parent node pointer to null, clear the child node list of the currently visited node node, set the refresh status of the currently visited node node to false, and enter step 3.3a after visiting all the nodes in the node stack.
[0019] Step 3.3a, return the lowest back edge back_connection and the new root node new_sub_root corresponding to the subtree.
[0020] Step 5a as described above comprises the following steps:
[0021] Step 5.1a, initialize the lowest back edge pointer to_lowest of the new root node new_sub_root to point to the new root node itself, and initialize the refresh state of the new root node new_sub_root to false;
[0022] Step 5.2a, traverse the adjacent points u_node of the new root node new_sub_root whose depth is not -1: if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the adjacent point u_node of the new root node new_sub_root, then update the lowest back-edge pointer to_lowest of the new root node new_sub_root, and make the lowest back-edge pointer to_lowest of the new root node new_sub_root point to the adjacent point u_node of the new root node new_sub_root;
[0023] Select one of the adjacent points u_node of the new root node new_sub_root with a depth of -1, set the depth of the selected adjacent point to the depth of the new root node new_sub_root + 1, set the parent node pointer of the selected adjacent point u_node to the new root node new_sub_root, add the selected adjacent point u_node to the child node list of the new root node new_sub_root, then use the selected adjacent point u_node as the updated new root node new_sub_root, return to step 5.1a until the depth of the adjacent points u_node of the new root node new_sub_root is not -1, and go to step 5.3a;
[0024] Step 5.3a, if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node in the adjacency list of the new root node new_sub_root, update the lowest back-edge pointer to_lowest of the new root node new_sub_root, and make the lowest back-edge pointer to_lowest of the new root node new_sub_root point to the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node;
[0025] If the new root node new_sub_root is not the root node r of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node of the new root node new_sub_root is greater than or equal to the depth of the new root node new_sub_root, then the cut point state of the new root node new_sub_root is marked as true.
[0026] As described above, step 7a includes the following steps:
[0027] Step 7.1a, initialize the cut point state of the node lowest_connection_node to false, initialize the lowest back edge pointer to_lowest of the node lowest_connection_node to point to the node lowest_connection_node itself, and update the refresh state of the node lowest_connection_node to true,
[0028] Step 7.2a, traverse the child node list of the node lowest_connection_node, and perform the following operations on each child node child in the child node list: If the refresh status of the child node child is false, then use the child node child as the updated node lowest_connection_node to enter step 7.1a for recursion. The condition for the recursion to end is that all nodes below the node lowest_connection_node on the DFS tree have been judged as child nodes child for refresh status. After the recursion ends, enter step 7.3a.
[0029] Step 7.3a, if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child, then update the lowest back-edge pointer to_lowest of the node lowest_connection_node to point to the node pointed to by the lowest back-edge pointer to_lowest of the child node child,
[0030] If the node lowest_connection_node is the root node r of the DFS tree and the number of child nodes is greater than 1, or the node lowest_connection_node is not the root node of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child is greater than or equal to the depth of the node lowest_connection_node, then mark the cut point state of the node lowest_connection_node as true,
[0031] Step 7.4a, traverse the adjacency list of the node lowest_connection_node, and for each adjacent point u_node in the adjacency list of the node lowest_connection_node whose open state is true, enter the following judgment: if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the adjacent point u_node of the node lowest_connection_node, then update the lowest back-edge pointer of the node lowest_connection_node to point to the adjacent point u_node of the node lowest_connection_node.
[0032] A method for updating and maintaining key nodes in a complex network, further comprising the step of updating and maintaining a cut point set in a hypergraph to which the node is added, specifically comprising:
[0033] Step 1b, perform a depth-first search traversal on the original graph, initialize the original graph into a DFS tree T(r), where r is the root node of the entire DFS tree, obtain the initial cut point set Cuts and non-cut point set NonCuts of the original graph through the Tarjan algorithm, and record the information of each node, including the depth, parent node pointer, lowest back edge pointer to_lowest, open state, and refresh state;
[0034] Step 2b: Add a random node to the original graph u , create an array neighbors[] to store nodes u All adjacent points connected, and add the information of all nodes and edges adjacent to node u in the adjacency list of the original graph, from node u Select an adjacent point with the largest depth from the adjacency list, record it as the subtree root node sub_root, record all the nodes on the path (r, sub_root) from the root node r of the DFS tree to the subtree root node sub_root, store them in a Boolean array v_on_path_to_root[], and initialize the refresh status of all nodes in the Boolean array v_on_path_to_root[] to false;
[0035] Step 3b, Node uIn addition to the subtree root node sub_root, the adjacency list of is also divided into adjacent points on the path (r, sub_root) and adjacent points not on the path (r, sub_root). The adjacent points not on the path (r, sub_root) are all recorded as sub-subtree root nodes sub_sub_root. The subtree where each sub-subtree root node sub_sub_root is located is called a sub-subtree of the DFS tree. The node u The adjacent point with the smallest depth in the adjacency list and on the path (r, sub_root) is recorded as the lowest neighbor node lowest_connection_node, the set subsubroots[] stores all the sub-subtree root nodes sub_sub_root, and the set connections[] stores all the connection points connecting the sub-subtrees to the DFS tree;
[0036] Step 4b, disconnect the sub-subtree stored in the set connections[] from the DFS tree, mark the nodes where the cut point status may change, and reset the information of all nodes in the sub-subtree stored in the set connections[].
[0037] Step 5b: Set the node u The depth of the subtree root node sub_root is set to the depth + 1, and the node u The parent node pointer points to the subtree root node sub_root, and the node u Add to the child node list of the subtree root node sub_root and clear the node u List of child nodes, the node u Set the refresh status of the node to false, traverse the subsubroots[] set returned in step 3b, and for each sub-subroot node sub_sub_root in the subsubroots[] set, u Add each sub-root node sub_sub_root in the subsubroots[] collection to the child node list, and let the parent node pointer of the sub-subtree root node sub_sub_root point to the added node u , let the depth of the sub-subtree root node sub_sub_root be the added node u Depth +1;
[0038] Step 6b, take each sub-subtree root node sub_sub_root in the set subsubroots[] as the new root node, take the sub-subtree root node sub_sub_root as the new root node new_sub_root, rebuild the corresponding sub-subtree, and update the cut point set in the sub-subtree in the process;
[0039] Step 7b: Repair the lowest back-edge pointers of some nodes below the node lowest_connection_node and update the cut point set.
[0040] Step 8b: The cut point set consisting of all nodes whose cut point states are marked as true is the cut point set after the hypergraph with the nodes added to the original graph is updated.
[0041] Step 3b as described above includes the following steps:
[0042] Step 3.1b, create two empty sets connections[] and subsubroots[], and initialize the lowest neighbor point lowest_connection_node as node u ;
[0043] Step 3.2b: Traverse the nodes u For each neighbor v_id whose open state is true in the neighbor point set neighbors[], if the neighbor v_id in the Boolean array v_on_path_to_root[] is true, go to step 3.3b, otherwise, go to step 3.4b;
[0044] Step 3.3b, if the depth of the neighboring point v_id is less than the depth of the lowest neighboring node lowest_connection_node, update the lowest neighboring node lowest_connection_node to make it the neighboring point v_id, and then return to step 3.2b until all nodes are traversed. u All adjacent points of go to step 3.5b;
[0045] Step 3.4b, if the adjacent point v_id in the Boolean array v_on_path_to_root[] is false, initialize the current visited node curr_node to the adjacent point v_id, and enter the following update step: when the parent node curr_node.parent of the current visited node curr_node is not on the path (r, sub_root), update the current visited node curr_node to the parent node curr_node.parent of the current visited node curr_node. After the above update step is completed, enter the judgment: if the depth of the parent node curr_node.parent of the current visited node curr_node is less than the depth of the lowest adjacent point lowest_connection_node, update the lowest adjacent point lowest_connection_node to the parent node curr_node.parent of the current visited node curr_node. After the judgment is completed, add the current visited node curr_node to the collection connections[], add the adjacent point v_id to the collection subsubroots[], and then return to step 3.2 until the nodes are traversed. u All adjacent points of go to step 3.5b;
[0046] Step 3.5b, return the collection connections[] and the collection subsubroots[], and return the lowest adjacent point lowest_connection_node.
[0047] Step 4b as described above includes the following steps:
[0048] Step 4.1b, traverse all sub-subtree connection points connection_node in the collection connections[], and initialize the current access node pointer curr Point to the parent node connection_node.parent of the currently visited sub-subtree connection point connection_node, and enter the following update steps: When the currently visited node pointer curr If the node pointed to is not equal to the lowest neighbor node lowest_connection_node returned in step 3b, the currently visited node pointer curr The refresh status of the node pointed to is marked as false, and then the currently visited node pointer is updated curr Pointer to the currently visited node curr The parent node of the node pointed to by the needle, after the above update step is completed, go to step 4.2b;
[0049] Step 4.2b, delete the currently traversed sub-subtree connection point connection_node from the child node list of its parent node connection_node.parent, and then go to step 4.3b;
[0050] Step 4.3b, reset the depth of the currently traversed sub-subtree connection point connection_node to -1, reset the parent node pointer to null, clear the child node list of the sub-subtree connection point connection_node, and set the refresh state of the sub-subtree connection point connection_node to false.
[0051] Step 6b as described above includes the following steps:
[0052] Step 6.1b, initialize the lowest back edge pointer to_lowest of the new root node new_sub_root to point to the new root node itself, and initialize the refresh state of the new root node new_sub_root to false.
[0053] Step 6.2b, traverse the adjacent points u_node of the new root node new_sub_root whose depth is not -1: if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the adjacent point u_node of the new root node new_sub_root, then update the lowest back-edge pointer to_lowest of the new root node new_sub_root to point to the adjacent point u_node of the new root node new_sub_root;
[0054] Select one of the adjacent points u_node of the new root node new_sub_root with a depth of -1, set the depth of the selected adjacent point to the depth of the new root node new_sub_root + 1, set the parent node pointer of the selected adjacent point u_node to the new root node new_sub_root, add the selected adjacent point u_node to the child node list of the new root node new_sub_root, and then use the selected adjacent point u_node as the updated new root node new_sub_root, return to step 6.1 until the depth of the adjacent points u_node of the new root node new_sub_root is not -1, and proceed to step 6.3,
[0055] Step 6.3b: If the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node in the adjacency list of the new root node new_sub_root, update the lowest back-edge pointer to_lowest of the new root node new_sub_root to point to the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node.
[0056] If the new root node new_sub_root is not the root node r of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node of the new root node new_sub_root is greater than or equal to the depth of the new root node new_sub_root, then the cut point state of the new root node new_sub_root is marked as true.
[0057] Step 7b as described above includes the following steps:
[0058] Step 7.1b, initialize the cut point state of the node lowest_connection_node to false, initialize the lowest back edge pointer to_lowest of the node lowest_connection_node to point to the node lowest_connection_node itself, and update the refresh state of the node lowest_connection_node to true;
[0059] Step 7.2b, traverse the child node list of the node lowest_connection_node, and perform the following operations on each child node child in the child node list: if the refresh status of the child node child is false, then use the child node child as the updated node lowest_connection_node to enter step 7.1b for recursion. The condition for the recursion to end is that all nodes below the node lowest_connection_node on the DFS tree have been judged as child nodes child for refresh status. After the recursion ends, enter step 7.3b;
[0060] Step 7.3b, if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child, then update the lowest back-edge pointer to_lowest of the node lowest_connection_node to point to the node pointed to by the lowest back-edge pointer to_lowest of the child node child,
[0061] If the node lowest_connection_node is the root node r of the DFS tree and the number of child nodes is greater than 1, or the node lowest_connection_node is not the root node of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child is greater than or equal to the depth of the node lowest_connection_node, then mark the cut point state of the node lowest_connection_node as true;
[0062] Step 7.4b, traverse the adjacency list of the node lowest_connection_node, and for each adjacent point u_node in the adjacency list of the node lowest_connection_node whose open state is true, enter the following judgment: if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the adjacent point u_node of the node lowest_connection_node, then update the lowest back-edge pointer to_lowest of the node lowest_connection_node to point to the adjacent point u_node of the node lowest_connection_node.
[0063] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned method for updating and maintaining key nodes when executing the computer program.
[0064] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for updating and maintaining key nodes.
[0065] Compared with the prior art, the present invention has the following beneficial effects:
[0066] The present invention dynamically maintains the existing DFS tree structure and flexibly applies the idea of Tarjan algorithm to discuss the change of node cut point state according to the different situations of subgraphs and hypergraphs. The present invention provides a dynamic way to identify key nodes in complex networks, which has advantages in practical network applications and avoids the need to recalculate the energy consumption of all nodes after each network change. In the problem of updating and maintaining the cut point set in a dynamic graph, the present invention has achieved significant improvements and breakthroughs.
[0067] Traditional methods have many drawbacks in updating the cut point set of dynamic graphs. As we all know, traditional methods usually recalculate the new graph using the Tarjan algorithm after the graph has changed. Even if only a small part of the nodes in the dynamic graph has changed, the entire graph still needs to be calculated, which generates a lot of unnecessary repeated calculations in the process. In addition, since the entire graph needs to be recalculated, the performance of traditional methods is low when processing the cut point set of dynamic graphs, especially when the graph scale is large and the algorithm complexity is high. This performance loss will be particularly significant. Compared with this method of updating and maintaining the cut point set in the dynamic graph, the traditional method lacks real-time response, resulting in a large waste of resources and consuming more computing time.
[0068] In summary, the present invention has great changes and innovations in updating and maintaining key nodes in complex networks. By dynamically maintaining the depth-first search generation tree and node information, the cut point set in the dynamic graph is updated and maintained. The present invention has been experimentally proven to be far more efficient than traditional algorithms, and avoids the problems of repeated calculation costs, performance loss, lack of real-time response, and waste of resources in traditional algorithms. The present invention can provide more efficient and fast real-time response communication services for complex networks, while greatly reducing the repeated calculation rate and total computing energy consumption of network nodes, bringing great potential and prospects for the update and identification of key nodes in future complex networks. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1Schematic diagram of updating and maintaining the cut point set in the subgraph where the node is deleted (orange nodes are cut points, dotted lines represent back edges, and shadows represent nodes that need to be rescanned to determine the status of the cut points), where (a) is a schematic diagram of the original graph; (b) is a schematic diagram of the initial DFS tree of the original graph; (c) is a schematic diagram of the new root nodes and the lowest back edges of the two subtrees found after deleting node c from the original graph in step 3a; (d) is a schematic diagram of making node f a child of node a and node h a child of node b in step 4a; (e) ) is a schematic diagram of the reconstruction and update of the cut point of the subtree T(d) in step 5a; (f) is a schematic diagram of the reconstruction and update of the cut point of the subtree T(e) in step 5a; (g) is a schematic diagram of the updated DFS tree; (h) is a schematic diagram of the nodes (shaded parts) on the updated DFS tree where the cut point status may change; (i) is a schematic diagram of updating the lowest back-edge pointer of the nodes below node a and updating the cut point in step 7a; (j) is a schematic diagram of the cut point (orange-marked node) obtained in step 8a;
[0070] Figure 2 Schematic diagram of updating and maintaining the cut point set in a hypergraph with added nodes, where (a) is a schematic diagram of the original graph; (b) is a schematic diagram of the initial DFS tree of the original graph; (c) is a schematic diagram of adding node u to the original graph; (d) is a schematic diagram of disconnecting and resetting the sub-subtree T(e) in step 4b; (e) is a schematic diagram of taking node u as the child node of the sub-root node f and taking the sub-sub-root node h as the child node of node u in step 5b; (f) is a schematic diagram of rebuilding and updating the cut points of the sub-subtree T(e) in step 6b; (g) is a schematic diagram of the updated DFS tree; (h) is a schematic diagram of the nodes (shaded parts) on the updated DFS tree where the cut point status may change; (i) is a schematic diagram of the cut points (orange-marked nodes) obtained in step 8b. DETAILED DESCRIPTION
[0071] In order to facilitate the understanding and implementation of the present invention by those skilled in the art, the present invention is further described in detail below with reference to examples. It should be understood that the implementation examples described herein are only used to illustrate and explain the present invention and are not used to limit the present invention.
[0072] In graph theory, an articulation point is a vertex in an undirected connected graph that, if removed (and its connected edges), will cause the original graph to no longer be connected. In other words, if a vertex is removed from a graph and the graph is no longer connected, the vertex is called an articulation point.
[0073] In an undirected connected graph G = {V, E}, if vertex v is a cut vertex, then there exists at least one pair of vertices u and w such that after v is removed, u and w are no longer connected.
[0074] Cut points are key nodes in a graph, and their existence can affect the connectivity of the graph. In a graph, the cut point set refers to the set of all cut points. Finding the cut point set is very important for understanding the structure and properties of the graph, because cut points often represent important nodes in the graph or key nodes connecting different graph blocks.
[0075] Embodiment 1:
[0076] The present invention discusses two situations of dynamic graphs, namely subgraphs and hypergraphs. Subgraphs refer to the situation where a specific node is deleted from the original graph; on the contrary, hypergraphs refer to the situation where a specific node is added to the original graph. The present invention focuses on the method of updating and maintaining the cut point set in both subgraphs and hypergraphs.
[0077] A method for updating and maintaining key nodes in a complex network comprises the following steps:
[0078] The update and maintenance steps of the cut point set in the subgraph where the node is deleted (see Figure 1 ):
[0079] In this embodiment: the original graph G = (V, E), its vertex set V(G) = {r, a, b, c, d, e, f, g, h}, and the edge set E(G) = {(r, a), (a, b), (a, f), (b, c), (b, h), (c, d), (c, e), (d, f), (d, g), (e, h)}.
[0080] Step 1a, in this embodiment, the original image is the original image of the wireless communication network, and each node in the original image of the wireless communication network corresponds to a router. Perform a depth-first search traversal on the original image, initialize the original image to a DFS tree T (r) (where r is the root node of the entire DFS tree), obtain the initial cut point set Cuts and non-cut point set NonCuts of the original image through the Tarjan algorithm, and record the information of each node (including depth, parent node pointer, lowest back edge pointer to_lowest, open state, refresh state, etc.). The parent node in all the following tables refers to the node pointed to by the parent node pointer, and the lowest back edge refers to the node pointed to by the lowest back edge pointer. TRUE in the table means true, FALSE means false, a cut point state of TRUE means a cut point, and a cut point state of FALSE means a non-cut point. Table 1 is a record table of the information of each node after implementing step 1a in the update and maintenance step of the cut point set in the subgraph of the deleted node.
[0081] Table 1
[0082]
[0083] Step 2a: Randomly select a node v from the non-cut point set NonCuts and delete it from the original graph to obtain the subgraph G of the original graph. -, set the open state of node v to false. Delete node v from the child node list of node v's parent node, and then set node v's parent node pointer to null.
[0084] In this embodiment, a node c is randomly deleted from the non-cut point set NonCuts, the open state of c is set to FALSE, node c is deleted from the child node list of the parent node b of node c, and the parent node pointer of node c is set to null, indicating that the node has been deleted.
[0085] Step 3a: For all subtrees of the deleted node v, reset the information of all nodes in the subtree, and return the lowest back edge back_connection and new root node new_sub_root of each subtree connected to the DFS tree. Each subtree corresponds to a lowest back edge back_connection and a new root node new_sub_root.
[0086] In this embodiment, for the subtree T(d) and subtree (e) of the deleted node c, all nodes in the subtree T(d) and subtree (e) are reset, and the lowest back edge back_connection and new root node new_sub_root of the subtree T(d) and subtree (e) are returned. The new root node of the subtree T(d) is node f, and the lowest back edge is node a. The new root node of the subtree T(e) is node h, and the lowest back edge is node b. Table 2 is a table of information records of each node after implementing step 3a in the update and maintenance steps of the cut point set in the subgraph where the node is deleted.
[0087] Table 2
[0088]
[0089] As described above, the process of resetting the node information of the subtree and returning the lowest back edge and the new root node of the subtree in step 3a includes the following steps:
[0090] Step 3.1a: For each subtree, create a node stack to store all nodes in the subtree, with the top node being the old root node of the subtree. Start accessing the nodes in the stack from the top node, and pop each node after access. Use node to refer to the currently accessed node, and initialize the depth parameter bar_depth to store the depth of the currently accessed node node. Go to step 3.2a.
[0091] Step 3.2a, traverse the adjacent points of the adjacency list of the currently visited node node. If the depth of the adjacent point u_node in the adjacency list of the currently visited node node is less than the depth parameter bar_depth, update the depth parameter bar_depth and set the depth parameter bar_depth equal to the depth of the adjacent point u_node of the currently visited node node. At this time, the new root node new_sub_root is the currently visited node node, and the lowest back edge back_connection is the adjacent point u_node of the currently visited node node. Reset the depth of the currently visited node node to -1, reset the parent node pointer to null, clear the child node list of the currently visited node node, and set the refresh status of the currently visited node node to false. After visiting all nodes in the node stack, proceed to step 3.3a.
[0092] Step 3.3a, return the lowest back edge back_connection and the new root node new_sub_root corresponding to the subtree.
[0093] Step 4a: point the parent node pointer of the new root node new_sub_root to the corresponding lowest back edge back_connection, add the new root node new_sub_root to the child node list of the lowest back edge back_connection, and set the depth of the new root node new_sub_root to the depth of the lowest back edge back_connection + 1.
[0094] In this embodiment, the parent node pointer of the new root node f is pointed to the lowest back edge a, and the new root node f is added to the child node list of the lowest back edge a, and the depth of the new root node f is set to the depth of the lowest back edge a + 1. The parent node pointer of the new root node h is pointed to the lowest back edge b, and the new root node h is added to the child node list of the lowest back edge b, and the depth of the new root node h is set to the depth of the lowest back edge b + 1. Table 3 is a table of information records of each node after implementing step 4a in the update and maintenance step of the cut point set in the subgraph where the node is deleted.
[0095] Table 3
[0096]
[0097] Step 5a: For the subtree in step 3a, use the returned new root node new_sub_root as the new root node, rebuild the subtree based on the new root node through recursive DFS, and update the cut point set in the subtree in the process.
[0098] In this embodiment, in step 3a, subtree T(d) takes node f as the new root node, and subtree T(e) takes node h as the new root node. The two subtrees are reconstructed by recursive DFS to obtain subtrees T(f) and T(h), and the cut point sets of the new subtrees T(f) and T(h) are updated by Tarjan algorithm in the process. Finally, the cut point set of the subtree update is {f, d, h}. Table 4 is a table of information records of each node after implementing step 5a in the update and maintenance step of the cut point set in the subgraph where the node is deleted.
[0099] Table 4
[0100]
[0101] As described above, in step 5a, rebuilding the subtree and updating the cut point set in the subtree includes the following steps:
[0102] Step 5.1a: Initialize the lowest back-edge pointer to_lowest of the new root node new_sub_root to point to the new root node itself, and initialize the refresh state of the new root node new_sub_root to false.
[0103] Step 5.2a, traverse the adjacent point u_node of the new root node new_sub_root whose depth is not -1 (that is, the adjacent point has been visited): if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the adjacent point u_node of the new root node new_sub_root, then update the lowest back-edge pointer to_lowest of the new root node new_sub_root, and make the lowest back-edge pointer to_lowest of the new root node new_sub_root point to the adjacent point u_node of the new root node new_sub_root;
[0104] Select one of the adjacent points u_node of the new root node new_sub_root with a depth of -1 (that is, the adjacent point has not been visited), set the depth of the selected adjacent point to the depth of the new root node new_sub_root + 1, set the parent node pointer of the selected adjacent point u_node to the new root node new_sub_root, add the selected adjacent point u_node to the child node list of the new root node new_sub_root, and then use the selected adjacent point u_node as the updated new root node new_sub_root, return to step 5.1a until the depths of the adjacent points u_node of the new root node new_sub_root are not -1 (all have been visited), and proceed to step 5.3a.
[0105] Step 5.3a. If the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node in the adjacency list of the new root node new_sub_root, update the lowest back-edge pointer to_lowest of the new root node new_sub_root and set the lowest back-edge pointer to_lowest of the new root node new_sub_root to point to the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node.
[0106] If the new root node new_sub_root is not the root node r of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the neighboring point u_node of the new root node new_sub_root is greater than or equal to the depth of the new root node new_sub_root, then the cut point state of the new root node new_sub_root is marked as true. At this time, the cut point set of the subtree is updated.
[0107] Step 6a, deleting node v may cause some nodes with edge relationships with node v to change their cut point status. Mark these nodes. In the subsequent steps, the algorithm will rescan the marked nodes to determine whether they are cut points. Specific analysis shows that due to the deletion of node v, the subtree originally connected to node v is disconnected from the DFS tree and can only be connected to the DFS tree through the lowest back_connection corresponding to the subtree returned in step 3a. Therefore, the nodes on the path from node v to the lowest back_connection corresponding to the subtree need to be marked. Note that the node with the smallest depth among the lowest back_connections corresponding to all subtrees is selected here, recorded as node lowest_connection_node. The algorithm sets the refresh status of all nodes on the path from node lowest_connection_node to the deleted node v (i.e., path (lowest_connection_node,v)) to false.
[0108] In this embodiment, after deleting node c, the subtree originally connected to node c is connected to node a through another lowest back edge. Therefore, on the original initial DFS tree, the nodes on the path from node c to node a (i.e., a and b) may still have a change in the cut point state, and their refresh state is set to FALSE. The refresh state of other nodes does not change. Go to step 7a. Table 5 is a record table of the information of each node after implementing step 6a in the update and maintenance step of the cut point set in the subgraph where the node is deleted.
[0109] Table 5
[0110]
[0111] Step 7a, since the lowest back-edge pointer to_lowest of the new root node new_sub_root of the subtree in step 5a is updated, and the subtree is connected to the DFS tree through the new lowest back-edge back_connection, the lowest back-edge pointers of other nodes will also change, among which the back-edge node with the lowest depth is the node lowest_connection_node. Therefore, it is necessary to repair the lowest back-edge pointers of the nodes below the node lowest_connection_node in the DFS tree and update the cut point set.
[0112] In this embodiment, the updated cut point set after rescanning can be obtained as {a, b}. Table 6 is a table recording information of each node after implementing step 7a in the update and maintenance step of the cut point set in the subgraph where the node is deleted.
[0113] Table 6
[0114]
[0115] As described above, repairing the lowest back-edge pointer and updating the cut point set in step 7a includes the following steps:
[0116] Step 7.1a, initialize the cut point state of the node lowest_connection_node to false, initialize the lowest back edge pointer to_lowest of the node lowest_connection_node to point to the node lowest_connection_node itself, and update the refresh state of the node lowest_connection_node to true.
[0117] Step 7.2a, traverse the child node list of the node lowest_connection_node, and perform the following operations on each child node child in the child node list: If the refresh status of the child node child is false, use the child node child as the updated node lowest_connection_node and go to step 7.1a for recursion. After the recursion ends (the condition for the recursion to end is that all nodes below the node lowest_connection_node on the DFS tree have been judged as child nodes child for refresh status), go to step 7.3a.
[0118] Step 7.3a. If the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child, then update the lowest back-edge pointer to_lowest of the node lowest_connection_node to point to the node pointed to by the lowest back-edge pointer to_lowest of the child node child.
[0119] If the node lowest_connection_node is the root node r of the DFS tree and the number of child nodes is greater than 1, or the node lowest_connection_node is not the root node of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child is greater than or equal to the depth of the node lowest_connection_node, then the cut point state of the node lowest_connection_node is marked as true.
[0120] Step 7.4a, traverse the adjacency list of the node lowest_connection_node, and for each adjacent point u_node in the adjacency list of the node lowest_connection_node whose open state is true, enter the following judgment: if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the adjacent point u_node of the node lowest_connection_node, then update the lowest back-edge pointer to_lowest of the node lowest_connection_node to point to the adjacent point u_node of the node lowest_connection_node.
[0121] Step 8a: Based on the results obtained in step 5a and step 7a, the cut point set consisting of nodes whose cut point states are marked as true is the cut point set after the subgraph of the original graph with the nodes deleted is updated. The algorithm ends.
[0122] Example step 8a: In summary, according to the final node information record table, it can be obtained that the cut point set of the subgraph updated after deleting the node c from the original graph is Cuts*={a,b,d,f,h}.
[0123] The update and maintenance steps of the cut point set in the hypergraph with added nodes (see Figure 2 ):
[0124] In this embodiment: the original graph G = (V, E), its vertex set V(G) = {r, a, b, c, d, e, f, g, h}, and the edge set E(G) = {(r, a), (a, b), (b, c), (c, d), (c, e), (d, f), (d, g), (e, h)}.
[0125] Step 1b, in this embodiment, the original image is the original image of the wireless communication network, and each node in the original image of the wireless communication network corresponds to a router. Perform a depth-first search traversal on the original image, initialize the original image to a DFS tree T(r) (where r is the root node of the entire DFS tree), obtain the initial cut point set Cuts and non-cut point set NonCuts of the original image through the Tarjan algorithm, and record the information of each node (including depth, parent node pointer, lowest back edge pointer to_lowest, open state, refresh state, etc.). The parent node in all the following tables refers to the node pointed to by the parent node pointer, and the lowest back edge refers to the node pointed to by the lowest back edge pointer. TRUE in the table means true, FALSE means false, a cut point state of TRUE means a cut point, and a cut point state of FALSE means a non-cut point.
[0126] In this embodiment, a depth-first search traversal is performed on the original graph, the original graph is initialized as a DFS tree T(r), and the initial cut point set Cuts and non-cut point set NonCuts of the original graph are obtained by Tarjan algorithm, and the information of each node is recorded. Thus, the initial cut point set Cuts = {a, b, c, d, e} of the original graph can be obtained.
[0127] Table 7 is a table recording the information of each node after implementing step 1b in the update and maintenance step of the cut point set in the hypergraph with added nodes.
[0128] Table 7
[0129]
[0130] Step 2b: Add a random node to the original graph u ,according to u The connection relationship with other nodes in the original graph is established by establishing an array neighbors[] to store the connection relationship with the nodes u All adjacent points connected to node u are added to the adjacency list of the original graph. uSelect an adjacent point with the largest depth from the adjacency list, record it as the subtree root node sub_root, record all the nodes on the path (r, sub_root) from the root node r of the DFS tree to the subtree root node sub_root, and store them in a Boolean array v_on_path_to_root[]. If the node of the Boolean array v_on_path_to_root[] is true, then the node is on the path (r, sub_root); if the node of the Boolean array v_on_path_to_root[] is false, then the node is not on the path (r, sub_root).
[0131] In this embodiment, a node u is randomly added to the original graph, and the information of all nodes and edges adjacent to node u is added to the adjacency list of the original graph. An adjacent point f with the largest depth is selected from the adjacency list of node u as the subtree root node. At the same time, the refresh status of all nodes on the path from the subtree root node f to the root node r of the DFS tree is marked as false.
[0132] Table 8 is a table recording the information of each node after implementing step 2b in the update and maintenance step of the cut point set in the hypergraph with added nodes.
[0133] Table 8
[0134]
[0135] Step 3b, Node u In addition to the sub-tree root node sub_root, the adjacency list of is divided into two types of nodes, namely, the adjacent points on the path (r, sub_root) and the adjacent points not on the path (r, sub_root). The adjacent points not on the path (r, sub_root) are all recorded as sub-sub-tree root nodes sub_sub_root. The subtree where each sub-sub-tree root node sub_sub_root is located is called a sub-subtree of the DFS tree. u The adjacent point with the smallest depth in the adjacency list and on the path (r, sub_root) is recorded as the lowest neighbor node lowest_connection_node. The set subsubroots[] stores all the sub-subtree root nodes sub_sub_root, and the set connections[] stores all the connection points of the sub-subtree connected to the DFS tree. In step 3b, the algorithm will find the set connections[], the set subsubroots[] and the lowest neighbor node lowest_connection_node and return them.
[0136] In this embodiment, the set connections[]={e) and the set subsubroots[={h} returned in step 3b, and the lowest neighbor node is node a.
[0137] Step 3b as described above includes the following steps:
[0138] Step 3.1b, create two empty collections connections[] and subsubroots[] to store the connection points and root nodes of the sub-subtrees respectively, and initialize the lowest adjacent point lowest_connection_node as node u .
[0139] Step 3.2b, traverse the nodes u For each neighbor v_id whose open state is true in the neighbor set neighbors[], if the neighbor v_id in the Boolean array v_on_path_to_root[] is true, go to step 3.3b. Otherwise, go to step 3.4b.
[0140] Step 3.3b: If the depth of the neighboring point v_id is less than the depth of the lowest neighboring node lowest_connection_node, update the lowest neighboring node lowest_connection_node to make it the neighboring point v_id. Then return to step 3.2b until all nodes are traversed. u Go to step 3.5b for all adjacent points.
[0141] Step 3.4b, if the neighboring node v_id in the Boolean array v_on_path_to_root[] is false, initialize the current visited node curr_node to the neighboring node v_id, and proceed to the following update step: When the parent node curr_node.parent of the current visited node curr_node is not on the path (r, sub_root) (that is, the Boolean array v _When curr_node.parent in on_path_to_root[] is false, update the currently visited node curr_node to the parent node curr_node.parent of the currently visited node curr_node. After the above update step is completed, enter the judgment: if the depth of the parent node curr_node.parent of the currently visited node curr_node is less than the depth of the lowest neighboring point lowest_connection_node, update the lowest neighboring point lowest_connection_node to the parent node curr_node.parent of the currently visited node curr_node. After the judgment is completed, add the currently visited node curr_node to the collection connections[], add the neighboring point v_id to the collection subsubroots[], and then return to step 3.2 until the nodes are traversed. u Go to step 3.5b for all adjacent points.
[0142] Step 3.5b, return the collection connections[] and the collection subsubroots[], and return the lowest adjacent point lowest_connection_node.
[0143] Step 4b. Since the collection connections[] stores the connection point connection_node that connects each sub-subtree to the DFS tree, it is now necessary to disconnect the sub-subtree stored in the collection connections[] from the DFS tree, mark the nodes where the cut point status may change, and reset the information of all nodes in the sub-subtree stored in the collection connections[].
[0144] In this embodiment, the sub-subtree T(e) where the sub-subtree root node h is located is disconnected from the DFS tree, and then the information of all nodes in the sub-subtree is reset.
[0145] Table 9 is a table recording the information of each node after implementing step 4b in the update and maintenance step of the cut point set in the hypergraph with added nodes.
[0146] Table 9
[0147]
[0148] Step 4b as described above includes the following steps:
[0149] Step 4.1b, traverse all sub-subtree connection points connection_node in the collection connections[], and initialize the current access node pointer currPoint to the parent node connection_node.parent of the currently visited sub-subtree connection point connection_node, and enter the following update steps: When the currently visited node pointer curr If the node pointed to is not equal to the lowest neighbor node lowest_connection_node returned in step 3b, the currently visited node pointer curr The refresh status of the node pointed to is marked as false (marking that the node may change its cut point status), and then the currently visited node pointer is updated curr , let it point to the currently visited node pointer curr The parent node of the node pointed to by the pointer. After the above update step is completed, go to step 4.2b.
[0150] Step 4.2b, delete the currently traversed sub-subtree connection point connection_node from the child node list of its parent node connection_node.parent, and then go to step 4.3b.
[0151] Step 4.3b, reset the depth of the currently traversed sub-subtree connection point connection_node to -1, reset the parent node pointer to null, clear the child node list of the sub-subtree connection point connection_node, and set the refresh state of the sub-subtree connection point connection_node to false.
[0152] Step 5b: Set the node u The depth of the subtree root node sub_root is set to the depth + 1, and the node u The parent node pointer points to the subtree root node sub_root. u Add to the child node list of the subtree root node sub_root and clear the node u List of child nodes, the node u Set the refresh status of to false. Traverse the subsubroots[] set returned in step 3b, and for each sub-root node sub_sub_root in the subsubroots[] set, u Add each sub-root node sub_sub_root in the subsubroots[] collection to the child node list, and let the parent node pointer of the sub-subtree root node sub_sub_root point to the added node u , let the depth of the sub-subtree root node sub_sub_root be the added node u The depth of +1.
[0153] In this embodiment, node u is added to the child node list of subtree root node f, the depth of node u is set to the depth of subtree root node f + 1, the parent node pointer of node u is pointed to subtree root node f, and then the child node list of node u is cleared, and the refresh state of node u is set to false. Because h is a sub-sub-root node, sub-sub-root node h is added to the child node list of node u, the parent node pointer of sub-sub-root node h is pointed to node u, and the depth of sub-sub-root node h is set to the depth of node u + 1.
[0154] Table 10 is a table recording the information of each node after implementing step 5b in the update and maintenance step of the cut point set in the hypergraph with added nodes.
[0155] Table 10
[0156]
[0157] Step 6b: Take each sub-subtree root node sub_sub_root in the set subsubroots[] as the new root node, pass in the sub-subtree root node sub_sub_root as the new root node new_sub_root, rebuild the corresponding sub-subtree, and update the cut point set in the sub-subtree in the process.
[0158] In this embodiment, the sub-subtree root node h is used as the new root node to rebuild the sub-subtree T(e), obtain the new sub-subtree T(h) and the final DFS tree, and update the cut point set in the sub-subtree in the process to obtain the updated sub-subtree cut point set. Table 11 is a table of information records of each node after implementing step 6b in the update and maintenance step of the cut point set in the hypergraph with added nodes.
[0159] Table 11
[0160]
[0161]
[0162] The process of rebuilding the sub-subtree and updating the cut point set in step 6b as described above includes the following steps:
[0163] Step 6.1b: Initialize the lowest back-edge pointer to_lowest of the new root node new_sub_root to point to the new root node itself, and initialize the refresh state of the new root node new_sub_root to false.
[0164] Step 6.2b, traverse the adjacent point u_node of the new root node new_sub_root whose depth is not -1 (that is, the adjacent point has been visited): if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the adjacent point u_node of the new root node new_sub_root, then update the lowest back-edge pointer to_lowest of the new root node new_sub_root, and make the lowest back-edge pointer to_lowest of the new root node new_sub_root point to the adjacent point u_node of the new root node new_sub_root;
[0165] Select one of the adjacent points u_node of the new root node new_sub_root with a depth of -1 (that is, the adjacent point has not been visited), set the depth of the selected adjacent point to the depth of the new root node new_sub_root + 1, set the parent node pointer of the selected adjacent point u_node to the new root node new_sub_root, add the selected adjacent point u_node to the child node list of the new root node new_sub_root, and then use the selected adjacent point u_node as the updated new root node new_sub_root, return to step 6.1 until the depths of the adjacent points u_node of the new root node new_sub_root are not -1 (all have been visited), and proceed to step 6.3.
[0166] Step 6.3b. If the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node in the adjacency list of the new root node new_sub_root, update the lowest back-edge pointer to_lowest of the new root node new_sub_root and set the lowest back-edge pointer to_lowest of the new root node new_sub_root to point to the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node.
[0167] If the new root node new_sub_root is not the root node r of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the neighboring point u_node of the new root node new_sub_root is greater than or equal to the depth of the new root node new_sub_root, then the cut point state of the new root node new_sub_root is marked as true. At this time, the cut point set of the sub-subtree is updated.
[0168] Step 7b: Since the nodes have been marked in the previous steps, uThe node that is affected and may change the state of the cut point, and the node with the smallest depth is the node lowest_connection_node. Therefore, the node lowest_connection_node is passed as a parameter, the lowest back-edge pointers of the nodes below the node lowest_connection_node are repaired, and the cut point set is updated.
[0169] In this embodiment, it is known that the shaded nodes in the figure are nodes where the cut point state may change. Among them, the node with the lowest depth is the lowest neighbor node, and the lowest back-edge pointers of the nodes below the lowest neighbor node are repaired to update the cut point set. Note: r is the root node, and its number of child nodes has not changed, so the cut point state of r remains unchanged. Table 12 is a record table of the information of each node after implementing step 7b in the update and maintenance steps of the cut point set in the hypergraph with added nodes.
[0170] Table 12
[0171]
[0172] Step 7.1b, initialize the cut point state of the node lowest_connection_node to false, initialize the lowest back edge pointer to_lowest of the node lowest_connection_node to point to the node lowest_connection_node itself, and update the refresh state of the node lowest_connection_node to true.
[0173] Step 7.2b, traverse the child node list of the node lowest_connection_node, and perform the following operations on each child node child in the child node list: If the refresh status of the child node child is false, use the child node child as the updated node lowest_connection_node and go to step 7.1b for recursion. After the recursion ends (the condition for the recursion to end is that all nodes below the node lowest_connection_node on the DFS tree have been judged as child nodes child for refresh status), go to step 7.3b.
[0174] Step 7.3b, if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child, then update the lowest back-edge pointer to_lowest of the node lowest_connection_node to point to the node pointed to by the lowest back-edge pointer to_lowest of the child node child.
[0175] If the node lowest_connection_node is the root node r of the DFS tree and the number of child nodes is greater than 1, or the node lowest_connection_node is not the root node of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child is greater than or equal to the depth of the node lowest_connection_node, then the cut point state of the node lowest_connection_node is marked as true.
[0176] Step 7.4b, traverse the adjacency list of the node lowest_connection_node, and for each adjacent point u_node in the adjacency list of the node lowest_connection_node whose open state is true, enter the following judgment: if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the adjacent point u_node of the node lowest_connection_node, then update the lowest back-edge pointer to_lowest of the node lowest_connection_node to point to the adjacent point u_node of the node lowest_connection_node.
[0177] Step 8b: Combining the results of step 5b and step 7b, the cut point set consisting of nodes whose cut point states are marked as true is the cut point set after the hypergraph with nodes added to the original graph is updated, and the algorithm ends.
[0178] In this embodiment, according to the final node information record table, it can be obtained that the cut point set of the supergraph updated after adding the node u to the original graph is {a, d}.
[0179] Table 13 and Table 14 show the comparison between the calculation results of the present method on the subgraph and hypergraph respectively and the results of the Tarjan algorithm recalculating the new graph. The comparative experiment uses the same example, including a Sparse example set of 15 undirected connected graphs, which can be divided into 5 small example groups, and the number of nodes in each group is 1000, 1500, 2000, 2500, and 3000 respectively. In each small example group, although the nodes are the same, the number of edges is gradually increasing, which means that the complexity of the graph is gradually increasing. The update column records the average calculation time of the update maintenance cut point set applied by the present invention on each example, while the Tarjan column records the average calculation time required using the traditional Tarjan algorithm, both in seconds. ratio represents the ratio of the calculation time of the update maintenance algorithm of the present invention to that of the Tarjan algorithm.
[0180] Among them, Table 13 is a comparison table of the calculation results of the update and maintenance steps of the cut point set in the subgraph where the node is deleted by the present method and the calculation results of the new graph recalculated by the Tarjan algorithm. Analysis of Table 13 shows that in the application of each small example, the ratio is less than 1, indicating that the update and maintenance algorithm of the present invention is significantly better than the traditional Tarjan algorithm in terms of computational efficiency when processing the subgraph generated by deleting the node in the original graph. Further observation of each small example group shows that when the number of nodes in the graph is the same, the fewer the number of edges in the graph, the more obvious the advantage of the update and maintenance algorithm. Table 14 is a comparison table of the calculation results of the update and maintenance steps of the cut point set in the hypergraph where the node is added by the present method and the calculation results of the new graph recalculated by the Tarjan algorithm.
[0181] In summary, the experiment further demonstrates that the update and maintenance algorithm for the cut point set in the dynamic graph proposed by the present invention is applicable in any case where the graph changes (specifically, subgraphs and hypergraphs). Compared with the traditional Tarjan algorithm, the performance of the present invention on the example set is significantly better, avoiding a large amount of repeated calculations and resource waste, and improving the efficiency and practicality of the algorithm.
[0182] Table 13
[0183]
[0184] Table 14
[0185]
[0186]
[0187] Embodiment 2:
[0188] In this embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0189] Embodiment 3:
[0190] In this embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0191] Embodiment 4:
[0192] In this embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0193] The embodiments described in the present invention are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the described embodiments or replace them in similar ways, but they will not deviate from the spirit of the present invention or exceed the scope defined by the appended claims.
Claims
1. A method for updating and maintaining key nodes in a complex network, characterized in that: The updating and maintenance steps of the cut point set in the subgraph where the node is deleted include: Step 1a: Perform a depth-first search traversal on the original graph and initialize the original graph as a DFS tree T(r), where r is the root node of the entire DFS tree. Use the Tarjan algorithm to obtain the initial cut point set Cuts and non-cut point set NonCuts of the original graph, and record the information of each node, including the depth, parent node pointer, lowest back edge pointer to_lowest, open state, and refresh state. Step 2a: Randomly select a node v from the non-cut point set NonCuts and delete it from the original graph to obtain the subgraph G of the original graph. - , set the open state of node v to false, delete node v from the child node list of the parent node of node v, and then set the parent node pointer of node v to null; Step 3a: For all subtrees of the deleted node v, reset the information of all nodes in the subtree, and return the lowest back edge back_connection and the new root node new_sub_root of each subtree connected to the DFS tree; Step 4a, point the parent node pointer of the new root node new_sub_root to the corresponding lowest back edge back_connection, add the new root node new_sub_root to the child node list of the lowest back edge back_connection, and set the depth of the new root node new_sub_root to the depth of the lowest back edge back_connection + 1; Step 5a: For the subtree in step 3a, use the returned new root node new_sub_root as the new root node, rebuild the subtree based on the new root node through recursive DFS, and update the cut point set in the subtree in the process; Step 6a, select the node with the smallest depth in the lowest back edge back_connection corresponding to all subtrees, record it as node lowest_connection_node, and set the refresh status of all nodes on the path (lowest_connection_node,v) from node lowest_connection_node to the deleted node v to false; Step 7a, repair the lowest back-edge pointer of the nodes below the node lowest_connection_node in the DFS tree, and update the cut point set; Step 8a: The cut point set consisting of all nodes whose cut point states are marked as true is the cut point set after the subgraph of the original graph with the nodes deleted is updated.
2. A method for updating and maintaining key nodes in a complex network according to claim 1, characterized in that: The step 3a comprises the following steps: Step 3.1a, for each subtree, build a node stack to store all the nodes in the subtree. The top node of the stack is the old root node of the subtree. Start accessing the nodes in the stack from the top node. After each node is accessed, it is popped out of the stack. Node is used to refer to the currently visited node. The depth parameter bar_depth is initialized to store the depth of the currently visited node node. Go to step 3.2a. Step 3.2a, traverse the adjacent points of the adjacency list of the currently visited node node. If the depth of the adjacent point u_node in the adjacency list of the currently visited node node is less than the depth parameter bar_depth, then update the depth parameter bar_depth, and set the depth parameter bar_depth equal to the depth of the adjacent point u_node of the currently visited node node. The new root node new_sub_root is the currently visited node node, and the lowest back edge back_connection is the adjacent point u_node of the currently visited node node. Reset the depth of the currently visited node node to -1, reset the parent node pointer to null, clear the child node list of the currently visited node node, set the refresh status of the currently visited node node to false, and enter step 3.3a after visiting all the nodes in the node stack. Step 3.3a: Return the lowest back edge back_connection and the new root node new_sub_root corresponding to the subtree.
3. A method for updating and maintaining key nodes in a complex network according to claim 2, characterized in that: The step 5a comprises the following steps: Step 5.1a, initialize the lowest back-edge pointer to_lowest of the new root node new_sub_root to point to the new root node itself, and initialize the refresh state of the new root node new_sub_root to false; Step 5.2a, traverse the adjacent points u_node of the new root node new_sub_root whose depth is not -1: if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the adjacent point u_node of the new root node new_sub_root, then update the lowest back-edge pointer to_lowest of the new root node new_sub_root, and make the lowest back-edge pointer to_lowest of the new root node new_sub_root point to the adjacent point u_node of the new root node new_sub_root; Select one of the adjacent points u_node of the new root node new_sub_root with a depth of -1, set the depth of the selected adjacent point to the depth of the new root node new_sub_root + 1, set the parent node pointer of the selected adjacent point u_node to the new root node new_sub_root, add the selected adjacent point u_node to the child node list of the new root node new_sub_root, then use the selected adjacent point u_node as the updated new root node new_sub_root, return to step 5.1a until the depth of the adjacent points u_node of the new root node new_sub_root is not -1, and go to step 5.3a; Step 5.3a, if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node in the adjacency list of the new root node new_sub_root, update the lowest back-edge pointer to_lowest of the new root node new_sub_root, and make the lowest back-edge pointer to_lowest of the new root node new_sub_root point to the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node; If the new root node new_sub_root is not the root node r of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node of the new root node new_sub_root is greater than or equal to the depth of the new root node new_sub_root, then the cut point state of the new root node new_sub_root is marked as true.
4. A method for updating and maintaining key nodes in a complex network according to claim 3, characterized in that: The step 7a comprises the following steps: Step 7.1a, initialize the cut point state of the node lowest_connection_node to false, initialize the lowest back edge pointer to_lowest of the node lowest_connection_node to point to the node lowest_connection_node itself, and update the refresh state of the node lowest_connection_node to true, Step 7.2a, traverse the child node list of the node lowest_connection_node, and perform the following operations on each child node child in the child node list: If the refresh status of the child node child is false, then use the child node child as the updated node lowest_connection_node to enter step 7.1a for recursion. The condition for the recursion to end is that all nodes below the node lowest_connection_node on the DFS tree have been judged as child nodes child for refresh status. After the recursion ends, enter step 7.3a. Step 7.3a, if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child, then update the lowest back-edge pointer to_lowest of the node lowest_connection_node to point to the node pointed to by the lowest back-edge pointer to_lowest of the child node child, If the node lowest_connection_node is the root node r of the DFS tree and the number of child nodes is greater than 1, or the node lowest_connection_node is not the root node of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child is greater than or equal to the depth of the node lowest_connection_node, then mark the cut point state of the node lowest_connection_node as true, Step 7.4a, traverse the adjacency list of the node lowest_connection_node, and for each adjacent point u_node in the adjacency list of the node lowest_connection_node whose open state is true, enter the following judgment: if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the adjacent point u_node of the node lowest_connection_node, then update the lowest back-edge pointer of the node lowest_connection_node to point to the adjacent point u_node of the node lowest_connection_node.
5. A method for updating and maintaining key nodes in a complex network according to claim 1, characterized in that: It also includes the update and maintenance steps of the cut point set in the hypergraph where the node is added, including: Step 1b, perform a depth-first search traversal on the original graph, initialize the original graph into a DFS tree T(r), where r is the root node of the entire DFS tree, obtain the initial cut point set Cuts and non-cut point set NonCuts of the original graph through the Tarjan algorithm, and record the information of each node, including the depth, parent node pointer, lowest back edge pointer to_lowest, open state, and refresh state; Step 2b: Add a random node to the original graph u , create an array neighbors[] to store nodes u All adjacent points connected, and add the information of all nodes and edges adjacent to node u in the adjacency list of the original graph, from node u Select an adjacent point with the largest depth from the adjacency list, record it as the subtree root node sub_root, record all the nodes on the path (r, sub_root) from the root node r of the DFS tree to the subtree root node sub_root, store them in a Boolean array v_on_path_to_root[], and initialize the refresh status of all nodes in the Boolean array v_on_path_to_root[] to false; Step 3b, Node u In addition to the subtree root node sub_root, the adjacency list of is also divided into adjacent points on the path (r, sub_root) and adjacent points not on the path (r, sub_root). The adjacent points not on the path (r, sub_root) are all recorded as sub-subtree root nodes sub_sub_root. The subtree where each sub-subtree root node sub_sub_root is located is called a sub-subtree of the DFS tree. The node u The adjacent point with the smallest depth in the adjacency list and on the path (r, sub_root) is recorded as the lowest neighbor node lowest_connection_node, the set subsubroots[] stores all the sub-subtree root nodes sub_sub_root, and the set connections[] stores all the connection points connecting the sub-subtrees to the DFS tree; Step 4b, disconnect the sub-subtree stored in the set connections[] from the DFS tree, mark the nodes where the cut point status may change, and reset the information of all nodes in the sub-subtree stored in the set connections[]. Step 5b: Set the node u The depth of the subtree root node sub_root is set to the depth + 1, and the node u The parent node pointer points to the subtree root node sub_root, and the node u Add to the child node list of the subtree root node sub_root and clear the node u List of child nodes, the node u Set the refresh status of the node to false, traverse the subsubroots[] set returned in step 3b, and for each sub-subroot node sub_sub_root in the subsubroots[] set, u Add each sub-root node sub_sub_root in the subsubroots[] collection to the child node list, and let the parent node pointer of the sub-subtree root node sub_sub_root point to the added node u , let the depth of the sub-subtree root node sub_sub_root be the added node u Depth +1; Step 6b, take each sub-subtree root node sub_sub_root in the set subsubroots[] as the new root node, take the sub-subtree root node sub_sub_root as the new root node new_sub_root, rebuild the corresponding sub-subtree, and update the cut point set in the sub-subtree in the process; Step 7b: Repair the lowest back-edge pointers of some nodes below the node lowest_connection_node and update the cut point set. Step 8b: The cut point set consisting of all nodes whose cut point states are marked as true is the cut point set after the hypergraph with the nodes added to the original graph is updated.
6. A method for updating and maintaining key nodes in a complex network according to claim 5, characterized in that: The step 3b comprises the following steps: Step 3.1b, create two empty sets connections[] and subsubroots[], and initialize the lowest neighbor point lowest_connection_node as node u ; Step 3.2b: Traverse the nodes u For each neighbor v_id whose open state is true in the neighbor point set neighbors[], if the neighbor v_id in the Boolean array v_on_path_to_root[] is true, go to step 3.3b, otherwise, go to step 3.4b; Step 3.3b, if the depth of the neighboring point v_id is less than the depth of the lowest neighboring node lowest_connection_node, update the lowest neighboring node lowest_connection_node to make it the neighboring point v_id, and then return to step 3.2b until all nodes are traversed. u All adjacent points of go to step 3.5b; Step 3.4b, if the adjacent point v_id in the Boolean array v_on_path_to_root[] is false, initialize the current visited node curr_node to the adjacent point v_id, and enter the following update step: when the parent node curr_node.parent of the current visited node curr_node is not on the path (r, sub_root), update the current visited node curr_node to the parent node curr_node.parent of the current visited node curr_node. After the above update step is completed, enter the judgment: if the depth of the parent node curr_node.parent of the current visited node curr_node is less than the depth of the lowest adjacent point lowest_connection_node, update the lowest adjacent point lowest_connection_node to the parent node curr_node.parent of the current visited node curr_node. After the judgment is completed, add the current visited node curr_node to the collection connections[], add the adjacent point v_id to the collection subsubroots[], and then return to step 3.2 until the nodes are traversed. u All adjacent points of go to step 3.5b; Step 3.5b, return the collection connections[] and the collection subsubroots[], and return the lowest adjacent point lowest_connection_node, The step 4b comprises the following steps: Step 4.1b, traverse all sub-subtree connection points connection_node in the collection connections[], and initialize the current access node pointer curr Point to the parent node connection_node.parent of the currently visited sub-subtree connection point connection_node, and enter the following update steps: When the currently visited node pointer curr If the node pointed to is not equal to the lowest neighbor node lowest_connection_node returned in step 3b, the currently visited node pointer curr The refresh status of the node pointed to is marked as false, and then the currently visited node pointer is updated curr Pointer to the currently visited node curr The parent node of the node pointed to by the needle, after the above update step is completed, go to step 4.2b; Step 4.2b, delete the currently traversed sub-subtree connection point connection_node from the child node list of its parent node connection_node.parent, and then go to step 4.3b; Step 4.3b, reset the depth of the currently traversed sub-subtree connection point connection_node to -1, reset the parent node pointer to null, clear the child node list of the sub-subtree connection point connection_node, and set the refresh state of the sub-subtree connection point connection_node to false.
7. A method for updating and maintaining key nodes in a complex network according to claim 6, characterized in that: The step 6b comprises the following steps: Step 6.1b, initialize the lowest back edge pointer to_lowest of the new root node new_sub_root to point to the new root node itself, and initialize the refresh state of the new root node new_sub_root to false. Step 6.2b, traverse the adjacent points u_node of the new root node new_sub_root whose depth is not -1: if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the adjacent point u_node of the new root node new_sub_root, then update the lowest back-edge pointer to_lowest of the new root node new_sub_root to point to the adjacent point u_node of the new root node new_sub_root; Select one of the adjacent points u_node of the new root node new_sub_root with a depth of -1, set the depth of the selected adjacent point to the depth of the new root node new_sub_root + 1, set the parent node pointer of the selected adjacent point u_node to the new root node new_sub_root, add the selected adjacent point u_node to the child node list of the new root node new_sub_root, and then use the selected adjacent point u_node as the updated new root node new_sub_root, return to step 6.1 until the depth of the adjacent points u_node of the new root node new_sub_root is not -1, and proceed to step 6.3, Step 6.3b: If the depth of the node pointed to by the lowest back-edge pointer to_lowest of the new root node new_sub_root is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node in the adjacency list of the new root node new_sub_root, update the lowest back-edge pointer to_lowest of the new root node new_sub_root to point to the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node. If the new root node new_sub_root is not the root node r of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the adjacent point u_node of the new root node new_sub_root is greater than or equal to the depth of the new root node new_sub_root, then the cut point state of the new root node new_sub_root is marked as true.
8. A method for updating and maintaining key nodes in a complex network according to claim 7, characterized in that: The step 7b comprises the following steps: Step 7.1b, initialize the cut point state of the node lowest_connection_node to false, initialize the lowest back edge pointer to_lowest of the node lowest_connection_node to point to the node lowest_connection_node itself, and update the refresh state of the node lowest_connection_node to true; Step 7.2b, traverse the child node list of the node lowest_connection_node, and perform the following operations on each child node child in the child node list: if the refresh status of the child node child is false, then use the child node child as the updated node lowest_connection_node to enter step 7.1b for recursion. The condition for the recursion to end is that all nodes below the node lowest_connection_node on the DFS tree have been judged as child nodes child for refresh status. After the recursion ends, enter step 7.3b; Step 7.3b, if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child, then update the lowest back-edge pointer to_lowest of the node lowest_connection_node to point to the node pointed to by the lowest back-edge pointer to_lowest of the child node child, If the node lowest_connection_node is the root node r of the DFS tree and the number of child nodes is greater than 1, or the node lowest_connection_node is not the root node of the DFS tree and the depth of the node pointed to by the lowest back-edge pointer to_lowest of the child node child is greater than or equal to the depth of the node lowest_connection_node, then mark the cut point state of the node lowest_connection_node as true; Step 7.4b, traverse the adjacency list of the node lowest_connection_node, and for each adjacent point u_node in the adjacency list of the node lowest_connection_node whose open state is true, enter the following judgment: if the depth of the node pointed to by the lowest back-edge pointer to_lowest of the node lowest_connection_node is greater than the depth of the adjacent point u_node of the node lowest_connection_node, then update the lowest back-edge pointer to_lowest of the node lowest_connection_node to point to the adjacent point u_node of the node lowest_connection_node.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for updating and maintaining key nodes according to any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for updating and maintaining key nodes described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Method and device for determining community discovery in social network and storage medium
CN109558518A
Accelerated execution method of deep learning model in dynamic change network environment
CN112990018A
Methods for peer-caching for faster lookups in peer-to-peer systems
US20090210489A1
Cited By
Power industrial control grid network topology generation method and system based on union-check set
CN120785754A