Method, device and product for querying the shortest impact path with high connectivity between users
By constructing the iterative optimization of the data structure of the index linked list and the upper and lower boundary values of the path connectivity, the problem of inaccurate link prediction in social network analysis is solved, and faster information dissemination and wider influence coverage are achieved.
Patent Information
- Application Number
- CN202411766225.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2044-12-04
AI Technical Summary
The existing social network analysis technology is not accurate enough in link prediction, and ignores the dissemination of users' indirect influence, resulting in slow spread of information and small coverage of influence during information dissemination.
Build an index linked list data structure, measure the influence propagation path between users through node information and single-hop connectivity values in the social network graph, and combine iterative optimization of the upper and lower boundary values of the path connectivity to optimize node selection to improve propagation speed and coverage.
By optimizing node selection, the speed of information dissemination and influence coverage are improved, a propagation path that is more in line with the real scenario is formed, and the shortest impact path for high connectivity is quickly determined.
Smart Images

Figure CN119691232B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, and product for querying a high-connectivity shortest impact path between users. Background Art
[0002] With the development of internet technology, the number of social network users has exploded. The study of the mutual influence between users during information dissemination has become a research focus in the field of data analysis. Link prediction, in this context, involves using known information about network nodes and network structure to predict the likelihood of a link forming between two nodes in a network where no edge has yet been established.
[0003] The main challenge currently faced by businesses and government agencies when promoting products or policies through the internet is how to rationally select nodes or paths in the information dissemination process. Therefore, how to increase the rationality of node selection during information dissemination, thereby increasing the speed of dissemination and expanding the scope of influence, is an urgent issue that needs to be addressed. Summary of the Invention
[0004] The purpose of this application is to provide a method, device and product for querying the shortest impact path of high connectivity between users, which can optimize the reasonable selection of nodes in the process of information dissemination, thereby accelerating the dissemination and expanding the coverage range.
[0005] To achieve the above objectives, this application provides the following solutions:
[0006] In a first aspect, the present application provides a method for querying the shortest impact path with high connectivity between users, comprising:
[0007] An index linked list data structure is constructed based on the obtained social network graph; the social network graph includes multiple nodes and edges connecting adjacent nodes, the nodes represent users in the social network, the edges represent the mutual influence between adjacent users, and the two nodes connected by each edge are neighbor nodes; the index linked list data structure is a linked list array data structure corresponding to each object node, the linked list array data structure includes an object node, one or more single-hop connectivity values corresponding to the object node, and a neighbor node linked list corresponding to each single-hop connectivity value; the single-hop connectivity value is the number of common neighbor nodes between adjacent nodes;
[0008] According to the given path connectivity value, and according to the index linked list data structure, the starting node, and the target node, it is determined whether the shortest impact path that meets the given path connectivity value can be obtained;
[0009] Determine the search range of the path connectivity value, that is, initialize the path connectivity lower bound value and path connectivity upper bound value. Specifically include:
[0010] Determine the path connectivity value at the current iteration number based on the lower bound value of the path connectivity at the previous iteration number, and call the step of "determining whether a shortest impact path that satisfies the given path connectivity value can be obtained based on the given path connectivity value and the index linked list data structure, the start node, and the target node." The given path connectivity value is the path connectivity value at the current iteration number. When the current iteration number is 1, the lower bound value of the path connectivity at the previous iteration number is set to 1.
[0011] If so, calculate the shortest influence path under the current iteration number and the path connectivity value corresponding to the shortest influence path under the current iteration number, then update the path connectivity lower bound value under the previous iteration number to the path connectivity value corresponding to the shortest influence path under the current iteration number, that is, the actual path connectivity value, and return to the step "determine the path connectivity value under the current iteration number according to the path connectivity lower bound value under the previous iteration number, and call the step "determine whether the shortest influence path that meets the given path connectivity value can be obtained according to the given path connectivity value and the index linked list data structure, the starting node, and the target node";
[0012] If not, the upper limit of the path connectivity at the previous iteration is updated to the path connectivity value at the current iteration to obtain the search range of the path connectivity value;
[0013] According to the lower bound value and upper bound value of the path connectivity under the last iteration number, the iteration is continued until the highly connected shortest influence path is determined; the highly connected shortest influence path is used to propagate information.
[0014] Optionally, the iteration is continued according to the lower bound and upper bound of the path connectivity at the last iteration number until a highly connected shortest impact path is determined. That is, searching for the highly connected shortest impact path within the range limited by the lower bound and upper bound of the path connectivity is performed, specifically including:
[0015] Determining a path connectivity median value for a current iteration based on the path connectivity lower bound and the path connectivity upper bound for a previous iteration, then updating the path connectivity value for the current iteration to the path connectivity median value for the current iteration, and calling the step of "determining whether a shortest influence path that satisfies the given path connectivity value can be obtained based on the given path connectivity value and the index linked list data structure, the start node, and the target node," to obtain a first determination result.
[0016] If the first judgment result is yes, the shortest influence path at the current iteration number and the path connectivity value corresponding to the shortest influence path at the current iteration number are calculated, and the path connectivity lower bound value at the previous iteration number is updated to the path connectivity value corresponding to the shortest influence path at the current iteration number; then, it is determined whether the difference between the path connectivity lower bound value and the path connectivity upper bound value at the previous iteration number is 1, and a second judgment result is obtained;
[0017] If the second judgment result is yes, the iteration is stopped, and the shortest influence path under the current number of iterations is determined as the highly connected shortest influence path;
[0018] If the second judgment result is no, return to the step of "determining the path connectivity median value at the current iteration number based on the path connectivity lower bound value and the path connectivity upper bound value at the previous iteration number, then updating the path connectivity value at the current iteration number to the path connectivity median value at the current iteration number, and calling the step of "determining whether a shortest influence path that satisfies the given path connectivity value can be obtained based on the given path connectivity value and the index linked list data structure, the starting node, and the target node" to obtain the first judgment result;
[0019] If the first judgment result is no, then the path connectivity upper bound value at the previous iteration number is updated to the path connectivity value at the current iteration number, and then it is determined whether the path connectivity lower bound value at the previous iteration number and the path connectivity upper bound value differ by 1, thereby obtaining a third judgment result;
[0020] If the third judgment result is yes, the iteration is stopped, and the shortest influence path under the last iteration number is determined as the high-connectivity shortest influence path;
[0021] If the result of the third judgment is no, return to the step "determine the path connectivity median value at the current iteration number based on the path connectivity lower limit value and the path connectivity upper limit value at the previous iteration number, and then update the path connectivity value at the current iteration number to the path connectivity median value at the current iteration number, and call the step "based on the given path connectivity value, and based on the index linked list data structure, the starting node, and the target node, determine whether the shortest impact path that meets the given path connectivity value can be obtained"".
[0022] In a second aspect, the present application provides a computer device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the above-mentioned method for querying the shortest impact path with high connectivity between users.
[0023] In a third aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned method for querying the shortest influential path with high connectivity between users.
[0024] According to the specific embodiments provided in this application, this application discloses the following technical effects:
[0025] The present application provides a method, device, and product for querying the shortest influence path with high connectivity between users. The present application constructs an index linked list data structure, combines the node information in the social network graph and the corresponding single-hop connectivity value of the node, measures the single-hop connectivity value by using the number of common neighbors between adjacent nodes in the social network graph, and uses this to analyze the influence propagation path between users. Nodes that are easily influenced can be queried, so that the formed propagation path can have a better propagation effect. Moreover, the present application continuously optimizes the estimation of the shortest influence path by adjusting the upper limit value and the lower limit value of the path connectivity through multiple iterations, and can quickly obtain the calculation results. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the following drawings without paying any creative work.
[0027] Figure 1 This is an application environment diagram of a method for querying a highly connected shortest impact path between users in one embodiment of the present application;
[0028] Figure 2 A flowchart of a method for querying the shortest influential path with high connectivity between users provided in one embodiment of the present application;
[0029] Figure 3 A schematic diagram of a social network diagram provided in another embodiment of the present application;
[0030] Figure 4 A schematic diagram of an index linked list data structure provided in another embodiment of the present application;
[0031] Figure 5 A schematic diagram of the initial set and state variable update process provided in another embodiment of the present application;
[0032] Figure 6 A schematic diagram of a search process for an upper limit value and a lower limit value of path connectivity provided by another embodiment of the present application;
[0033] Figure 7A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0035] Since existing social network analysis technologies usually use social network graphs to depict the influence relationship between users, where nodes are used to represent users, and the edges directly connecting nodes represent the influence propagation path between users, but in real life, the influence propagation relationship between people is not limited to direct propagation between two people, and in many cases it can also be propagated through other channels of mutual connection, such as through common friends. In other words, in traditional influence propagation path query methods, many times only the possibility of "direct propagation" is focused on, and the influence indirectly propagated through other users is ignored. Therefore, the present application provides a query method, device and product for the highly connected shortest influence path between users, which can solve the defect of inaccurate link prediction in existing social network analysis technologies, thereby improving the propagation speed and expanding the scope of influence coverage by optimizing the reasonable selection of nodes in the information propagation process.
[0036] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0037] The query method for the shortest impact path with high connectivity between users provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, integrated on the server 104, or placed on the cloud or other servers. The terminal 102 can send the input social network graph, starting node and target node to the server 104. After the server 104 receives the social network graph, starting node and target node, the server 104 constructs an index linked list data structure based on the acquired social network graph, and gradually updates and iterates the path connectivity lower limit value and the path connectivity upper limit value according to the index linked list data structure, the starting node, the target node and the path connectivity value under the current iteration number until a high-connectivity shortest influence path is determined. The server 104 can feed back the obtained high-connectivity shortest influence path to the terminal 102. In addition, in some embodiments, the query method of the influence propagation path between users can also be implemented independently by the server 104 or the terminal 102. For example, the terminal 102 can directly process the input social network graph, starting node and target node, or the server 104 can obtain the social network graph, starting node and target node to be processed from the data storage system and process them.
[0038] The terminal 102 may be, but is not limited to, various desktop computers, laptop computers, and IoT devices, and the server 104 may be implemented as an independent server or a server cluster consisting of multiple servers, or may be a cloud server.
[0039] In an exemplary embodiment, Figure 2 As shown, a method for querying the shortest impact path with high connectivity between users is provided. The method is executed by a computer device, specifically a computer device such as a terminal or a server, or a terminal and a server. In the embodiment of the present application, the method is applied to Figure 1 Taking the server 104 in the example as an example, the following steps 201 to 205 are included:
[0040] Step 201 constructs an index linked list data structure based on the acquired social network graph. The social network graph includes multiple nodes and edges connecting adjacent nodes. Nodes represent users in the social network, and edges represent the mutual influence between adjacent users. The two nodes connected by each edge are considered neighbors. The index linked list data structure is a linked list array data structure corresponding to each object node. The linked list array data structure includes an object node, one or more single-hop connectivity values corresponding to the object node, and a linked list of neighbor nodes corresponding to each single-hop connectivity value. The single-hop connectivity value represents the number of common neighbor nodes between adjacent nodes. After establishing the index linked list data structure, subsequent queries can reuse the index linked list data structure to query the single-hop connectivity values between a node and its neighbor nodes, thereby improving query efficiency. This specifically includes the following.
[0041] Step 2011: Input a social network graph G = (U, E), where the node set U = {u1, u2, u3, ..., ui, ...um} represents the set of users in the social network, and the node ui represents the user i; E = {e1, e2, e3, ...en} represents the edges connecting the nodes (i.e., the mutual influence between adjacent users), and the two nodes connected by each edge are neighbor nodes, indicating that the two users have a friendship relationship.
[0042] Step 2012: Define and initialize variables. The single-hop connectivity (CommonNeighbour, CN) value indicates the number of common neighbor nodes between adjacent nodes, that is, the number of common neighbors a user has with another user. Therefore, a user may have multiple CN values. For example, the neighbor node set of node u1 is N(u1) = {u2, u3, u4}, and the neighbor node set of node u3 is N(u3) = {u1, u2, u4, u5, u8}. Then u1 and u3 are adjacent nodes and have two common neighbors u2 and u4. At this time, the single-hop connectivity value between node u1 and node u3 is 2.
[0043] Assuming CN = j, a j-CN reachable node represents the neighbor node corresponding to a node when the single-hop connectivity value is j, that is, the user has j common neighbors. When a user and another user have more than j common neighbors, the two are said to be mutually reachable via j-CN.
[0044] Step 2013: Calculate the number of common neighbors between the node and its neighbor nodes.
[0045] Step 2013a: Assume that uk is a neighbor node of ui. Calculate the intersection N' = N(ui) ∩ N(uk) of the neighbor node set N(ui) of the ui node and the neighbor node set N(uk) of the uk node. Calculate the number of nodes in the obtained intersection, which is the number of common neighbor nodes shared by ui and uk. Use the array sumui[uk] = n to represent the number of common neighbor nodes shared by the ui node and its neighbor node uk, where n is the number of common neighbor nodes shared by the uk node and the ui node, and the uk node is the n-CN reachable node of the ui node. For example, u1 and u3 have two different neighbor nodes. According to the definition given above, u3 is a 2-CN reachable node of u1.
[0046] Step 2013b: Repeat step 2013a for all neighbor nodes of ui.
[0047] Step 2014: Generate an index linked list data structure for different CN values of the node and the neighbor nodes (ie, reachable nodes) corresponding to each CN value.
[0048] Step 214a: Create and initialize a linked list array CNui[maxCN+1]. The array index represents the CN value of node ui, and the array stores the pointer to the head node of the linked list of reachable nodes corresponding to this CN value. Since the CN values of each neighbor of ui have already been calculated in step 2013, the length of this array is the maximum CN value maxCN plus 1. If the index is 0, there is no need to store the linked list of reachable nodes, so the position with index 0 is left blank.
[0049] Step 2014b: Establish multiple reachable node linked lists based on the array length, and add the uk nodes to the cnLink linked lists of the corresponding CN values according to the array sumui[uk] obtained in step 2013. Specifically: (1) Use cnLink to represent the reachable node linked list, initialize the reachable node linked list cnLink with CN=sumui[uk]=n, and initialize its head node pointer headNode. (2) Insert the nodes in the array sumui[uk]=n into the end of the cnLink linked list according to their n values. For example, for node u1, sumu1[u2]=1 and sumu1[u4]=1 with CN=1, then add node u2 and node u4 to the cnLink of node u1 with CN=1: u2→u4, and save the head node pointer headNode pointing to node u2. (3) Store the head node pointer headNode pointing to the cnLink linked list corresponding to the CN value in the corresponding position of the linked list array CNui[n]. For example, for the u1 node, there is a cnLink with CN=1: u2→u4, so let the head node pointer CNu1[1] of the cnLink stored in CNu1[1] be headNode→u2.
[0050] Step 2014c: Repeat steps 2014a and 2014b until a cnLink linked list is established for each CN value of the ui node and the storage of the array linked list array CNui[n] is completed, forming an index linked list data structure of the ui node.
[0051] Step 2015: Repeat steps 2012-2014 until the index linked list data structure of each node in the node set U is established.
[0052] Step 202 determines whether a shortest impact path that satisfies the given path connectivity value can be obtained based on the given path connectivity value, the index linked list data structure, the starting node, and the target node. The given path connectivity value continuously changes based on the path connectivity value at the current input iteration number, and specifically includes the following content.
[0053] Step 2021: Create an initial set and state variables. Initially, the initial set includes only the start node, which is a subset of the set U containing all nodes. Assuming the shortest path from the start node to node v' is known, node v' is included in the initial set. State variables include the first state variable D(w), the second state variable P(w), and the third state variable CN_P(w).
[0054] The first state variable D(w) represents the shortest path length from the starting node through node v' to node w at the current stage. Node v' represents a node newly added to the initial set at the current stage, and node w represents a neighbor node of node v' that has not yet been added to the initial set. In the initial stage, since the initial set only contains the starting node, only the starting node's neighbor nodes are set to D(w) = 1, meaning the path length to the neighbor node is 1. The remaining node values are initialized to ∞, meaning they are currently unreachable. The second state variable P(w) represents the predecessor node, which can be node v'. The third state variable CN_P(w) represents the single-hop connectivity value between node w and the second state variable P(w).
[0055] Step 2022: Select the v' node with the minimum value of the first state variable D(w) in the current stage and add it to the initial set to obtain an updated initial set.
[0056] Step 2023: traverse the index linked list data structure of the v' node to determine whether the maximum single-hop connectivity value of the v' node is greater than or equal to the given path connectivity value.
[0057] Step 2023a: When the maximum single-hop connectivity value of the v' node is greater than or equal to the given path connectivity value, obtain neighbor nodes whose maximum single-hop connectivity values with the v' node are greater than or equal to the given path connectivity value, and update the state variables.
[0058] The formula for updating the first state variable D(w) is as follows.
[0059] D(w)=min(D(w), D(v')+1).
[0060] Where D(v') represents the shortest path length in the previous stage. If the first state variable D(w) changes, the second state variable P(w) is set to the v' node, and the third state variable CN_P(w) is set to the single-hop connectivity value between the v' node and the w node. If the first state variable D(w) does not change, the second state variable P(w) and the third state variable CN_P(w) remain unchanged.
[0061] Return to step “select the v' node with the minimum value of the first state variable D(w) in the current stage and add it to the initial set” until all nodes in the social network are in the initial set or the first state variables D(w) of the nodes not in the initial set are all ∞.
[0062] Determine whether the first state variable D(w) of the target node is ∞. When the first state variable D(w) of the target node is ∞, it means that the shortest influence path corresponding to the given path connectivity value cannot be obtained. When the first state variable D(w) of the target node is not ∞, it means that the shortest influence path corresponding to the given path connectivity value can be obtained, so that the minimum value of the single-hop connectivity value between all two adjacent nodes in the shortest influence path can be traversed and used as the actual path connectivity value of the shortest influence path.
[0063] Step 2023b: When the single-hop connectivity value of the v' node is less than the given path connectivity value, it means that the shortest influence path corresponding to the given path connectivity value cannot be obtained.
[0064] Step 203 : determining the search range of the path connectivity value, that is, initializing the path connectivity lower limit value and the path connectivity upper limit value, which specifically includes the following contents.
[0065] Step 2031: When the current iteration number is equal to 1, the lower limit value of the path connectivity at the previous iteration number is set to 1.
[0066] In step 2032, the path connectivity value at the current iteration number is set to twice the lower limit of the path connectivity value at the previous iteration number, and step 202 is called, "Based on the given path connectivity value, and based on the index linked list data structure, the starting node, and the target node, determine whether a shortest influence path that satisfies the given path connectivity value can be obtained."
[0067] In step 2032a, if yes, the shortest influence path at the current iteration and the path connectivity value corresponding to the shortest influence path at the current iteration are calculated. The lower bound of the path connectivity at the previous iteration is updated to the path connectivity value corresponding to the shortest influence path at the current iteration, and the process returns to step 2032. The path connectivity value corresponding to the shortest influence path at the current iteration is the minimum value of the single-hop connectivity values between all two adjacent nodes on the path connecting the two nodes (i.e., the shortest influence path at the current iteration).
[0068] If not, step 2032b outputs the lower bound of the path connectivity at the last iteration, and updates the upper bound of the path connectivity at the last iteration to the path connectivity at the current iteration, thus obtaining the initial lower bound and upper bound of the path connectivity, and proceeding to the next step.
[0069] Step 204 , based on the lower and upper bounds of the path connectivity at the previous iteration, obtains the middle value and rounds it down to the nearest integer. This value serves as the middle value of the path connectivity at the current iteration. A determination is then made as to whether a shortest influencing path exists for this path connectivity value. Specifically, the following steps are included.
[0070] Based on the lower bound and upper bound of the path connectivity at the previous iteration, the median value of the path connectivity at the current iteration is determined. The path connectivity value at the current iteration is then updated to the median value of the path connectivity at the current iteration. Step 202 is then called to determine whether the shortest impact path corresponding to the current iteration can be obtained, thereby obtaining a first determination result.
[0071] If the first judgment result is yes, then based on the path connectivity value at the current iteration number, calculate the shortest impact path at the current iteration number and the path connectivity value corresponding to the shortest impact path at the current iteration number, and update the path connectivity lower limit value at the previous iteration number to the path connectivity value corresponding to the shortest impact path at the current iteration number; then judge the path connectivity lower limit value and the path connectivity upper limit value to determine whether the difference is 1, and obtain the second judgment result.
[0072] If the second judgment result is yes, the iteration is stopped, and the shortest influence path corresponding to the current iteration number is determined as the highly connected shortest influence path; if the second judgment result is no, the next iteration of this step is entered.
[0073] If the first judgment result is no, the upper limit value of the path connectivity at the previous iteration number is updated to the path connectivity value corresponding to the current iteration number, and then it is determined whether the difference between the lower limit value of the path connectivity at the previous iteration number and the upper limit value of the path connectivity is 1 to obtain a third judgment result.
[0074] If the third judgment result is yes, the iteration is stopped, and the shortest influence path corresponding to the previous iteration number is determined as the highly connected shortest influence path; if the third judgment result is no, the next iteration of this step is entered.
[0075] Step 205: Return the highly connected shortest influence path for information dissemination.
[0076] In addition, the present embodiment provides a method for querying a highly connected shortest influence path between users, further comprising: using the path connectivity value and path length of the highly connected shortest influence path to determine the possibility of achieving an influence process between nodes, and performing information dissemination based on this highly connected shortest influence path.
[0077] By implementing the above steps 201 to 205, the present application constructs an index linked list data structure, combines the node information in the social network graph and the corresponding single-hop connectivity value of the node, and uses the number of common neighbors between adjacent nodes in the social network graph to measure the single-hop connectivity value, describing the possibility of influence propagation between users. The returned influence propagation path is more in line with the real scene, and is used to analyze the influence propagation path between users. It is possible to query the nodes that are more likely to achieve influence, so that the formed propagation path can have a wider propagation range. Moreover, the present application continuously optimizes the estimation of the shortest influence path by adjusting the upper limit value of the path connectivity and the lower limit value of the path connectivity for multiple iterations, and finally determines the shortest influence path with high connectivity. The possibility of the influence process between nodes can be judged by the path connectivity value and the path length. In addition, an index linked list data structure is established based on the single-hop connectivity value between adjacent nodes, which narrows the search range, and by introducing the upper limit value and the lower limit value of the path connectivity, the binary backoff method is used to quickly obtain the shortest influence path with high connectivity, thereby improving the search efficiency.
[0078] In another exemplary embodiment of the present application, a social network graph G1 is taken as an example for detailed description, which includes a node set {u1, u2, u3, u4, u5, u6, u7, u8}:
[0079] Step 1: Traverse and query the one-hop connectivity values between all nodes and their neighbor nodes in the social network graph, and generate an index linked list data structure for an object node, one or more one-hop connectivity values corresponding to an object node, and the neighbor nodes corresponding to each one-hop connectivity value.
[0080] Step 1.1: Input social network graph G1 = (U1, E1), such as Figure 3As shown, the node set U1 = {u1, u2, u3, u4, u5, u6, u7, u8} represents the set of users in the social network, where node ui represents user i, E1 represents the edges connecting the nodes, and each edge indicates that there is a friend relationship between two users, and they are neighbor nodes to each other.
[0081] Step 1.2: Define and initialize the single-hop connectivity (CommonNeighbour, CN) value.
[0082] Step 1.3: Calculate the number of common neighbors between the target node and its neighbor nodes.
[0083] Step 1.3.1: Taking u1 as an example, calculate the intersection of u1's neighbor node set and its neighbor node set. u1's neighbor node set is N(u1) = {u2, u3, u4}. Take the intersection with its neighbor node sets N(u2) = {u1, u3, u5, u6}, N(u3) = {u1, u2, u4, u5, u8}, N(u4) = {u1, u3, u5, u6} to get N(u1) ∩ N(u2) = {u3}, N(u1) ∩ N(u3) = {u2, u4}, N(u1) ∩ N(u4) = {u3}. Use the array sumu1 to record the number of common neighbors between u1 and all its neighbor nodes, and get sumu1[u2] = 1, sumu1[u3] = 2, sumu1[u4] = 1.
[0084] Step 1.4: Generate an index linked list data structure for one or more single-hop connectivity values corresponding to the object node and the neighbor nodes corresponding to each single-hop connectivity value.
[0085] Step 1.4.1: Create and initialize the array CNu1[maxCN+1]. Since the CN values of each neighboring node of u1 have been calculated in step 1.3, the length of this array is the maximum CN value (maxCN) plus 1. According to the array sumu1[uk] calculated in step 1.3.1, u1's maxCN is equal to 2, so create and initialize the array CNu1[3].
[0086] Step 1.4.2: Create a linked list of reachable nodes based on the length of array CNu1[3], and insert u1's neighbor nodes into the linked list in sequence according to the values of array sumu1[uk].
[0087] Step 1.4.2.1: Use cnLink to represent the reachable node linked list, initialize the reachable node linked list cnLink with CN=n, and initialize its head node pointer headNode.
[0088] Step 1.4.2.2: Insert the nodes in sumu1[uk] into the end of the cnLink list in sequence according to their values. According to step 1.3.2, sumu1[u2]=1, sumu1[u4]=1, and create a linked list cnLink: u2→u4.
[0089] Step 1.4.2.3: Store the head node pointer headNode pointing to the cnLink linked list corresponding to the CN value in the corresponding position of the array CNu1[n], such as CNu1[1] = headNode→u2→u4.
[0090] Step 1.4.3: Repeat steps 1.4.1 and 1.4.2 until a cnLink linked list is established for each CN value of the u1 node and the storage of the CNu1[n] array is completed, forming the index linked list data structure of the u1 node.
[0091] Step 1.5: Repeat steps 1.2-1.4 until the index linked list data structure of each node in the node set U1 is established. The final index linked list data structure is as follows Figure 4 shown.
[0092] Step 2: Assume that the starting node is u1 and the target node is u8. Also, assume that the given path connectivity constraint is 1. This means that we search for neighboring nodes with a CN value greater than or equal to 1 to obtain the shortest influence path between u1 and u8. Note that the path connectivity constraint in this step is variable and depends on the path connectivity value at the current iteration number input in the subsequent steps. It is assumed to be 1 here only to illustrate the specific operation process of this step.
[0093] Step 2.1: Create the initial set and state variables. The initial set is the set U1' = {u1} containing only the starting node. This is a subset of the set U1 containing all nodes. Assuming the shortest path from u1 to node v' is known, then v' is contained in U1'.
[0094] Step 2.1.1: Define D(w) as the shortest path length from the starting node u1 to the node w through the node v' in U1' in the current stage. In the initial stage, since there is only the starting node u1 in U1', only the neighbor node states of the starting node u1 are set to D(u2) = 1, D(u3) = 1, D(u4) = 1, and the values of the remaining nodes are assigned an initial value of ∞. Define P(w) to save the predecessor node on the shortest path to the node w in the current stage, then the neighbor node states of u1 are set to P(u2) = u1, P(u3) = u1, P(u4) = u1. Define CN_P(w) as the CN value between the w node and its P(w) in the current stage, according to the following Figure 4The index linked list data structure shown sets the neighbor node status of u1 to CN_P(u2)=1, CN_P(u3)=2, and CN_P(u4)=1.
[0095] Step 2.2: Select the v' node with the minimum D(w) value in the current stage and add it to the initial set. When U1'={u1} in the initial stage, find the u2 node with the minimum D(w) and add it to the set U1'.
[0096] Step 2.3: Traverse the index linked list data structure of u2, obtain the neighbor nodes {u1, u6, u3, u5} whose CN values are greater than or equal to the path connectivity value, and update their three state variables: D(w), P(w) and CN_P(w).
[0097] Step 2.3.1: Update D(w) according to the following expression:
[0098] D(w)=min(D(w), D(u2)+1). Calculation yields D(u6)=min(∞, 2)=2, D(u3)=min(1, 2)=1, and D(u5)=min(∞, 2)=2.
[0099] Step 2.3.2: Since D(u6) and D(u5) have changed, set P(u6) and P(u5) to P(u6) = u2 and P(u5) = u2, and set CN_P(u6) and CN_P(u5) to the single-hop connectivity CN values between u2 and u6 and u5, respectively, i.e., CN_P(u6) = 1 and CN_P(u5) = 2. Since D(u3) has not changed, the three states of node u3 remain unchanged.
[0100] Step 2.4: Iterate steps 2.2 and 2.3 until all nodes in set U1 are in set U1'. The result obtained after the initial set and state variables are updated is as follows: Figure 5 shown.
[0101] Step 2.5: If Figure 4 As shown, the target node's state value D(u8) = 2. Based on u8's predecessor node P(u8), we continuously backtrack to find the shortest impact path from the starting node u1 to the target node u8, ShortestPath = u1 → u3 → u8. We traverse ShortestPath to obtain the single-hop connectivity values of the adjacent nodes in the path. The minimum value is the path connectivity of the currently found shortest path, ShortestPath.
[0102] Step 3: Initialize the path connectivity lower bound minPathCN and upper bound maxPathCN of the starting node u1 and the target node u8.
[0103] Step 3.1: Set the path connectivity lower bound minPathCN to 1.
[0104] Step 3.2: Set the path connectivity value to twice the lower bound value, reuse the basic steps of the shortest path search process in step 2, narrow the search range of the index linked list data structure based on the current path connectivity value, and find whether there is a shortest path with connectivity greater than or equal to the current path connectivity value.
[0105] Step 3.2.1: Reuse the shortest path search process in step 2. Obviously, in step 2.3, the search range of the neighbor nodes of node v' is all nodes whose CN value is greater than or equal to the path connectivity value, that is, only the neighbor nodes whose CN value is greater than or equal to twice the path connectivity value are searched.
[0106] Step 3.2.2: Obtain the shortest path ShortestPath = u1 → u3 → u5 → u8, and assign the path connectivity value 2 of this path to minPathCN as the new path connectivity lower bound value.
[0107] Step 3.3: Repeat step 3.2 and find that no path with a path connectivity value of 4 is found. Set the upper limit of path connectivity to maxPathCN = 4, which is the upper limit of path connectivity in subsequent steps.
[0108] Step 4: Use the binary method to narrow the range of minPathCN and maxPathCN until minPathCN = maxPathCN-1, and obtain the shortest impact path with high connectivity. The search process of the upper and lower bounds of path connectivity is as follows: Figure 6 shown.
[0109] Step 4.1: Set PathCN to the middle value between the lower limit value minPathCN and the upper limit value maxPathCN and round down, that is, PathCN = └(minPathCN+maxPathCN) / 2┘ = └(2+4) / 2┘ = 3.
[0110] Step 4.2: Reuse the shortest path search process in step 2, use PathCN as the input of step 2.3, and limit the search range of neighbor nodes of node v' to all nodes with CN values greater than or equal to 3, that is, only search for neighbor nodes with CN values greater than or equal to 3.
[0111] Step 4.3: Since step 4.2 cannot find a path with a CN value greater than or equal to 3, set maxPathCN to 3.
[0112] Step 4.4: At this time, the condition minPathCN=maxPathCN-1 is met, so minPathCN=2 is the maximum connectivity from the starting node u1 to the target node u8. Save the shortest path ShortestPath=u1→u3→u5→u8 and the path connectivity value of this path 2, which is the high connectivity shortest influence path
[0113] Step 5: Return the obtained highly connected shortest influence path ShortestPath = u1 → u3 → u5 → u8.
[0114] exist Figure 3 In the figure, the highly connected shortest influence path between nodes u1 and u8 is u1→u3→u5→u8, and its path connectivity is 2. The existing shortest path calculation method obtains the shortest path between nodes u1 and u8 as u1→u3→u8, and its path connectivity is 1. Due to the existence of a path with a connectivity of 2, the possibility of the influence being finally achieved is increased during the propagation of u1's influence on u8. In actual marketing, if u1 represents a certain enterprise, and u1 has an influence path of the same length on two nodes, but the connectivity value of one of the paths is larger, then the market promotion of the node with the path with the larger connectivity value is more likely to succeed and has a better propagation effect. Therefore, the present invention can be used to analyze the possibility of influence between two nodes, helping enterprises or governments to more accurately select social network nodes for promotion.
[0115] The present application also provides an application scenario, which applies the above-mentioned method for querying the highly connected shortest influence path between users. Specifically: the method for querying the highly connected shortest influence path between users provided in this embodiment can be applied in information dissemination scenarios. The information dissemination scenario includes a path generation link and a path application link; the path generation link is used to construct an index linked list data structure based on the acquired social network graph, and continuously iterates based on the index linked list data structure, the starting node, and the target node to determine the highly connected shortest influence path; the path application link is used to disseminate information through the highly connected shortest influence path. The method for querying the highly connected shortest influence path between users provided in this embodiment belongs to the path generation link and the path application link.
[0116] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 7As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store processing data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for querying a high-connectivity shortest impact path between users is implemented.
[0117] In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0118] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0119] In an exemplary 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.
[0120] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0121] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0122] The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may include, but are not limited to, general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic units, data processing logic units based on quantum computing, and the like.
[0123] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0124] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above examples is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A method for querying the shortest influential path with high connectivity between users, characterized in that: The method for querying the shortest impact path with high connectivity between users includes: An index linked list data structure is constructed based on the acquired social network graph; the social network graph includes multiple nodes and edges connecting adjacent nodes, the nodes represent users in the social network, the edges represent the mutual influence between adjacent users, and the two nodes connected by each edge are neighbor nodes; the index linked list data structure is a linked list array data structure corresponding to each object node, the linked list array data structure includes an object node, one or more single-hop connectivity values corresponding to the object node, and a neighbor node linked list corresponding to each single-hop connectivity value; the single-hop connectivity value is the number of common neighbor nodes between adjacent nodes; Determining the path connectivity value at the current iteration number based on the path connectivity lower bound value at the previous iteration number, and invoking the step of "determining whether a shortest impact path that satisfies the given path connectivity value can be obtained based on the given path connectivity value and the index linked list data structure, the start node, and the target node"; wherein the given path connectivity value is the path connectivity value at the current iteration number; and when the current iteration number is 1, the path connectivity lower bound value at the previous iteration number is set to 1; If so, calculate the shortest influence path under the current iteration number and the path connectivity value corresponding to the shortest influence path under the current iteration number, then update the path connectivity lower bound value under the previous iteration number to the path connectivity value corresponding to the shortest influence path under the current iteration number, return to the step "determining the path connectivity value under the current iteration number according to the path connectivity lower bound value under the previous iteration number, and call the step "determining whether the shortest influence path that meets the given path connectivity value can be obtained according to the given path connectivity value and the index linked list data structure, the starting node, and the target node"; If not, the upper limit of the path connectivity at the previous iteration is updated to the path connectivity value at the current iteration to obtain the search range of the path connectivity value; Iteration is continued according to the lower limit value of the path connectivity and the upper limit value of the path connectivity at the last iteration number until a highly connected shortest influence path is determined; the highly connected shortest influence path is used to propagate information.
2. The method for querying the shortest influential path with high connectivity between users according to claim 1, characterized in that: Continue iterating according to the lower limit value and the upper limit value of the path connectivity at the last iteration number until a highly connected shortest impact path is determined, specifically including: Determining a path connectivity median value for a current number of iterations based on the path connectivity lower bound and the path connectivity upper bound for a previous number of iterations, then updating the path connectivity value for the current number of iterations to the path connectivity median value for the current number of iterations, and invoking the step of "determining, based on the given path connectivity value and the index linked list data structure, the start node, and the target node, whether a shortest influence path that satisfies the given path connectivity value can be obtained" to obtain a first determination result; If the first judgment result is yes, the shortest influence path at the current iteration number and the path connectivity value corresponding to the shortest influence path at the current iteration number are calculated, and the path connectivity lower bound value at the previous iteration number is updated to the path connectivity value corresponding to the shortest influence path at the current iteration number; then, it is determined whether the difference between the path connectivity lower bound value and the path connectivity upper bound value at the previous iteration number is 1, and a second judgment result is obtained; If the second judgment result is yes, the iteration is stopped, and the shortest influence path under the current number of iterations is determined as the highly connected shortest influence path; If the second judgment result is no, return to the step "determining the path connectivity median value at the current iteration number based on the path connectivity lower bound value and the path connectivity upper bound value at the previous iteration number, then updating the path connectivity value at the current iteration number to the path connectivity median value at the current iteration number, and calling the step "determining whether a shortest influence path that satisfies the given path connectivity value can be obtained based on the given path connectivity value and the index linked list data structure, the starting node, and the target node" to obtain the first judgment result; If the first judgment result is no, then the path connectivity upper bound value at the previous iteration number is updated to the path connectivity value at the current iteration number, and then it is determined whether the path connectivity lower bound value at the previous iteration number and the path connectivity upper bound value differ by 1, thereby obtaining a third judgment result; If the third judgment result is yes, the iteration is stopped, and the shortest influence path under the last iteration number is determined as the high-connectivity shortest influence path; If the result of the third judgment is no, return to the step of "determining the path connectivity median value at the current iteration number based on the path connectivity lower limit value and the path connectivity upper limit value at the previous iteration number, and then updating the path connectivity value at the current iteration number to the path connectivity median value at the current iteration number, and calling the step of "determining whether the shortest influence path that meets the given path connectivity value can be obtained based on the given path connectivity value and the index linked list data structure, the starting node, and the target node." 3. The method for querying the shortest influential path with high connectivity between users according to claim 2, characterized in that: According to a given path connectivity value, and according to the index linked list data structure, the starting node, and the target node, determining whether a shortest impact path that satisfies the given path connectivity value can be obtained specifically includes: Create an initial set and state variables; the initial set includes the starting node in the initial stage, and the state variables include a first state variable D(w), a second state variable P(w), and a third state variable CN_P(w); wherein the first state variable D(w) represents the shortest path length from the starting node to the w node through the v' node in the current stage, the v' node represents a node newly added to the initial set in the current stage, and the w node represents a neighbor node of the v' node that has not been added to the initial set in the current stage; the second state variable P(w) represents a predecessor node, and the second state variable P(w) is the v' node; the third state variable CN_P(w) represents the single-hop connectivity value between the w node and the second state variable P(w); Select the v' node with the minimum value of the first state variable D(w) in the current stage and add it to the initial set to obtain the updated initial set; Traverse the index linked list data structure of the v' node and determine whether the single-hop connectivity value of the v' node is greater than or equal to the given path connectivity value; When the single-hop connectivity value of the v' node is greater than or equal to a given path connectivity value, a neighboring node having a single-hop connectivity value with the v' node greater than or equal to the given path connectivity value is obtained, and the state variable is updated; returning to the step of "selecting the v' node with the minimum value of the first state variable D(w) in the current stage and adding it to the initial set" until all nodes in the social network are in the initial set or the first state variables D(w) of the nodes not in the initial set are all ∞; determining whether the first state variable D(w) of the target node is ∞; if the first state variable D(w) of the target node is ∞, it indicates that the shortest influence path corresponding to the given path connectivity value cannot be obtained; if the first state variable D(w) of the target node is not ∞, it indicates that the shortest influence path corresponding to the given path connectivity value can be obtained; When the single-hop connectivity value of the v' node is less than a given path connectivity value, it means that the shortest influence path corresponding to the given path connectivity value cannot be obtained.
4. The method for querying the shortest influential path with high connectivity between users according to claim 1, characterized in that: In the process of determining the search range of the path connectivity value, the path connectivity value at the current iteration is determined based on the lower bound value of the path connectivity at the previous iteration, specifically including: The value obtained by doubling the lower bound of path connectivity at the previous iteration number is determined as the upper bound of path connectivity corresponding to the current iteration number.
5. The method for querying the shortest influential path with high connectivity between users according to claim 3, characterized in that: Updating the state variables specifically includes: Update the first state variable D(w) according to the following formula: D(w)=min(D(w), D(v')+1); Where D(v') represents the shortest path length in the previous stage. If the first state variable D(w) changes, the second state variable P(w) is set to the v'th node, and the third state variable CN_P(w) is set to the single-hop connectivity value between the v'th node and the wth node. If the first state variable D(w) does not change, the second state variable P(w) and the third state variable CN_P(w) remain unchanged.
6. The method for querying the shortest influential path with high connectivity between users according to claim 1, characterized in that: The method for querying the shortest impact path with high connectivity between users also includes: The highly connected shortest influence path is used to propagate information.
7. A computer device comprising: A memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that the processor executes the computer program to implement the method for querying the shortest influential path with high connectivity between users according to any one of claims 1 to 6.
8. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for querying the shortest influential path with high connectivity between users according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Value domain-based query method and apparatus
CN111459979A
Method and device for sending and receiving path information
CN115344748A