Inter-user high-connectivity shortest influence path query method, device and product
By constructing the index linked list data structure and combining node information in the social network graph, the selection of information dissemination paths is optimized, and the problems of slow information dissemination speed and small influence coverage in the existing technology are solved, and faster dissemination and wider coverage are achieved.
Patent Information
- Application Number
- CN202411766225.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-12-04
AI Technical Summary
In the process of information dissemination, it is difficult for the prior art to reasonably select nodes or paths, resulting in slow propagation speed and small coverage of influence.
By constructing an index linked list data structure, combining node information and single-hop connectivity values in the social network graph, the selection of information propagation paths is optimized, and the number of common neighbors between neighboring nodes is used to measure the single-hop connectivity value, and nodes that are easily affected are queried to form a more effective propagation path.
Faster information dissemination and wider influence coverage are achieved, and the calculation results are quickly obtained through multiple iterations to optimize the estimation of the shortest impact path.
Smart Images

Figure CN119691232A_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, and the study of the mutual influence between users in the process of information dissemination has become a research focus in the field of data analysis. In this problem, link prediction refers to how to predict the possibility of a link between two nodes that have not yet been connected in the network based on known network nodes and network structure information.
[0003] At present, the main challenge faced by enterprises and government departments when promoting products or policies through Internet technology is how to reasonably select nodes or paths in the process of information dissemination. Therefore, how to increase the rationality of node selection in the process of information dissemination, so as to increase the speed of dissemination and expand the scope of influence coverage is an urgent problem to be solved. 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.
[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 a highly connected shortest impact path between users, comprising:
[0007] An index linked list data structure is constructed according to 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 to each other; 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 an 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 satisfies 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 the path connectivity upper bound value. Specifically include:
[0010] According to the lower bound value of the path connectivity at the previous iteration number, the path connectivity value at the current iteration number is determined, and the step of "according to the given path connectivity value, and according to the index linked list data structure, the starting node, and the target node, whether the shortest impact path that satisfies the given path connectivity value can be obtained" is called; wherein the given path connectivity value is the path connectivity value at the current iteration number; when the current iteration number is equal to 1, the lower bound value of the path connectivity at the previous iteration number is set to 1;
[0011] If so, calculate the shortest impact path under the current iteration number and the path connectivity value corresponding to the shortest impact path under the current iteration number, and then update the lower bound value of the path connectivity under the previous iteration number to the path connectivity value corresponding to the shortest impact 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 lower bound value of the path connectivity under the previous iteration number, and call the step "according to the given path connectivity value, and according to the index linked list data structure, the starting node, and the target node, determine whether the shortest impact path that satisfies the given path connectivity value can be obtained";
[0012] If not, the upper limit value of the path connectivity at the previous iteration number is updated to the path connectivity value at the current iteration number to obtain the search range of the path connectivity value;
[0013] According to the lower limit value of the path connectivity and the upper limit 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, according to the lower bound value of the path connectivity and the upper bound value of the path connectivity at the last iteration number, the iteration is continued until the highly connected shortest impact path is determined, that is, the highly connected shortest impact path is searched within the range limited by the lower bound value and the upper bound value of the path connectivity, specifically including:
[0015] According to the lower bound value and the upper bound value of the path connectivity at the last iteration number, the intermediate value of the path connectivity at the current iteration number is determined, and then the path connectivity value at the current iteration number is updated to the intermediate value of the path connectivity at the current iteration number, and the step of "according to the given path connectivity value, and according to the index linked list data structure, the starting node, and the target node, judging whether the shortest influence path that satisfies the given path connectivity value can be obtained" is called to obtain a first judgment result;
[0016] If the first judgment result is yes, then calculate the shortest impact path under the current iteration number and the path connectivity value corresponding to the shortest impact path under the current iteration number, and update the path connectivity lower limit value under the previous iteration number to the path connectivity value corresponding to the shortest impact path under the current iteration number; then judge whether the difference between the path connectivity lower limit value and the path connectivity upper limit value under the previous iteration number is 1, and obtain the second judgment result;
[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 high-connectivity shortest influence path;
[0018] If the second judgment result is no, then return to the step "determine the path connectivity intermediate value at the current iteration number according to 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 intermediate value at the current iteration number, and call the step "according to the given path connectivity value, and according to the index linked list data structure, the starting node, and the target node, determine whether the shortest impact path that satisfies the given path connectivity value can be obtained", and obtain the first judgment result";
[0019] 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 at 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;
[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 third judgment result is no, return to the step "determine the intermediate value of the path connectivity at the current number of iterations based on the lower limit value and upper limit value of the path connectivity at the previous number of iterations, and then update the path connectivity value at the current number of iterations to the intermediate value of the path connectivity at the current number of iterations, 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, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-mentioned method for querying the shortest influential 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 of high connectivity between users. In the present application, an index linked list data structure is constructed, and the node information in the social network graph and the corresponding single-hop connectivity value of the node are combined. The single-hop connectivity value is measured by using the number of common neighbors between adjacent nodes in the social network graph, and this is used 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 drawings required for use in the embodiments will be briefly introduced below. 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 high-connectivity shortest impact path between users in one embodiment of the present application;
[0028] Figure 2 A flowchart of a method for querying a highly connected shortest impact path between users provided in one embodiment of the present application;
[0029] Figure 3 A schematic diagram of a social network diagram provided for another embodiment of the present application;
[0030] Figure 4 A schematic diagram of an index linked list data structure provided by another embodiment of the present application;
[0031] Figure 5 A schematic diagram of an initial set and a state variable update process provided by another embodiment of the present application;
[0032] Figure 6 A schematic diagram of a search process for a path connectivity upper limit value and a path connectivity lower limit value 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 the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work 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 mutually connected channels, 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 technology, 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 objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with 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, the starting node and the target node to the server 104. After the server 104 receives the social network graph, the starting node and the target node, the server 104 constructs an index linked list data structure according to 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 the high connectivity shortest impact path is determined. The server 104 can feedback the obtained high connectivity shortest impact 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, and can be executed by a computer device such as a terminal or a server alone, or by a terminal and a server together. In the embodiment of the present application, the method is applied to Figure 1 The server 104 in the example is used as an example to illustrate, including the following steps 201 to 205:
[0040] Step 201, construct 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, 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 to each other; the index linked list data structure refers to the 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 an 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. After the index linked list data structure is established, subsequent queries can reuse the above-mentioned index linked list data structure to query the single-hop connectivity value between the node and its neighbor node, thereby improving the query efficiency. Specifically including the following contents.
[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 friend 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, so 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, then the single-hop connectivity value between node u1 and node u3 is 2.
[0043] At the same time, assuming that CN = j, the 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 j-CN reachable.
[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, and 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 of the ui node and its neighbor node uk, where n is the number of common neighbor nodes of 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 2014a: Create and initialize a linked list array CNui[maxCN+1]. The array subscript represents the CN value of the node ui, and the array stores the head node pointer of the reachable node linked list corresponding to this subscript CN value. Since the CN value of each neighbor node of ui has been obtained in step 2013, the length of the array is the maximum CN value maxCN plus 1. When the subscript is equal to 0, there is no need to store the reachable node linked list in the subscript, so the position with subscript 0 is left blank.
[0049] Step 2014b: Establish multiple reachable node linked lists according to the length of the array, 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 tail of the cnLink linked list according to their n values. For example, for the u1 node, sumu1[u2]=1 and sumu1[u4]=1 with CN=1, then add the u2 node and the u4 node to the cnLink of the u1 node with CN=1: u2→u4 in sequence, and save the head node pointer headNode pointing to the u2 node. (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]=headNode→u2 stored in CNu1[1].
[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, based on the given path connectivity value, and based on the index linked list data structure, the starting node, and the target node, it is determined whether a shortest impact path that satisfies the given path connectivity value can be obtained. The given path connectivity value is continuously changed according to the path connectivity value at the current number of iterations input, and specifically includes the following contents.
[0053] Step 2021, create an initial set and state variables. The initial set only includes the starting node in the initial stage, which is a subset of the set U containing all nodes. Assuming that the shortest path from the starting node to the v' node is known, the v' node is included in the initial set; the state variables include the first state variable D(w), the second state variable P(w) and the third state variable CN_P(w).
[0054] Among them, the first state variable D(w) represents the shortest path length from the starting node to the w node through the v' node at the current stage, the v' node represents the node newly added to the initial set at the current stage, and the w node represents the neighbor node of the v' node that has not been added to the initial set at the current stage; in the initial stage, since there is only the starting node in the initial set, only the neighbor nodes of the starting node are set to D(w) = 1, which means that the path length to the neighbor node is 1, and the remaining node values are assigned an initial value of ∞, which means that they are currently unreachable. The second state variable P(w) represents the predecessor node, which can be 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).
[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, the neighbor nodes whose maximum single-hop connectivity values with the v' node are greater than or equal to the given path connectivity value are obtained, and the state variables are updated.
[0058] The formula for updating the first state variable D(w) is as follows.
[0059] D(w)=min(D(w), D(v')+1).
[0060] Among them, 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) at 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 of 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, 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] Step 2032, set the path connectivity value at the current iteration number to twice the path connectivity lower limit value at the previous iteration number, and call step 202 "according to the given path connectivity value, and according to the index linked list data structure, the starting node, and the target node, determine whether the shortest impact path that satisfies the given path connectivity value can be obtained."
[0067] Step 2032a, if yes, 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, and return to step 2032. The path connectivity value corresponding to the shortest influence path under the current iteration number refers to 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 under the current iteration number).
[0068] Step 2032b, if not, the lower limit value of the path connectivity at the last iteration number is output, and the upper limit value of the path connectivity at the last iteration number is updated to the path connectivity value at the current iteration number, that is, the initial path connectivity lower limit value and path connectivity upper limit value are obtained, and then proceed to the next step.
[0069] Step 204, according to the lower limit value of the path connectivity and the upper limit value of the path connectivity at the previous iteration number, obtain the middle value and round it down to the integer, and use it as the middle value of the path connectivity at the current iteration number of this step to determine whether there is a shortest influencing path of the path connectivity value, which specifically includes the following contents.
[0070] According to the lower limit value and the upper limit value of the path connectivity at the previous iteration number, the middle value of the path connectivity at the current iteration number is determined, and then the path connectivity value at the current iteration number is updated to the middle value of the path connectivity at the current iteration number, and step 202 is called to determine whether the shortest impact path corresponding to the current iteration number can be obtained, and a first judgment result is obtained.
[0071] If the first judgment result is yes, then according to the path connectivity value under the current iteration number, calculate the shortest impact path under the current iteration number and the path connectivity value corresponding to the shortest impact path under the current iteration number, and update the lower limit value of the path connectivity under the previous iteration number to the path connectivity value corresponding to the shortest impact path under the current iteration number; then judge the lower limit value of the path connectivity and the upper limit value of the path connectivity 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 high-connectivity 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, which also includes: 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 propagation based on this highly connected shortest influence path.
[0077] By implementing the above steps 201 to 205, an index linked list data structure is constructed in the present application, which combines the node information in the social network graph and the corresponding single-hop connectivity value of the node. The single-hop connectivity value is measured by using the number of common neighbors between adjacent nodes in the social network graph to describe 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. Nodes that are more likely to achieve influence can be queried, 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 and the lower limit value of the path connectivity through multiple iterations, and finally determines the shortest influence path with high connectivity. The possibility of reaching 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 according to the single-hop connectivity value between adjacent nodes, which narrows the search range, and by introducing the upper and lower limits 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 object 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}, and 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} is obtained by taking the intersection of N(u1) ∩ N(u2) = {u3}, N(u1) ∩ N(u3) = {u2, u4}, N(u1) ∩ N(u4) = {u3}. Use array sumu1 to record the number of common neighbors of 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 value of each neighbor node of u1 has been obtained in step 1.3, the length of this array is the maximum CN value (maxCN) plus 1. According to the array sumu1[uk] obtained in step 1.3.1, the maxCN of u1 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 of 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 linked list in sequence according to their values. According to sumu1[u2]=1, sumu1[u4]=1 obtained in step 1.3.2, establish the 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 array CNu1[n] 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, and assume that the given path connectivity value constraint is 1, that is, search for neighbor nodes with CN values greater than or equal to 1 to obtain the shortest impact path between u1 and u8. Note that the path connectivity value constraint in this step depends on the path connectivity value of the current iteration number input in this step when it is called by subsequent steps, and is variable. It is assumed to be 1 here just to illustrate the specific operation process of this step.
[0093] Step 2.1: Create initial set and state variables. Set U1'={u1} containing only the starting node is used as the initial set, which is a subset of the set U1 containing all nodes. Assuming the shortest path from u1 to node v' is known, v' is included in U1'.
[0094] Step 2.1.1: Define D(w) as the shortest path length from the starting node u1 to the w node through the v' node 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 remaining node values are assigned initial values of ∞. Define P(w) to save the predecessor node on the shortest path to the w node 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). It is calculated that 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, P(u6) and P(u5) are set to P(u6) = u2 and P(u5) = u2, and CN_P(u6) and CN_P(u5) are set to the single-hop connectivity CN values between u2 and u6 and u5, 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 state value of the target node D(u8) = 2, and the search is continuously traced back to the previous node P(u8) of u8 to find the shortest influencing path ShortestPath = u1 → u3 → u8 from the starting node u1 to the target node u8. The single-hop connectivity values of the adjacent nodes in the path are obtained by traversing ShortestPath, and the minimum value is taken, which is the path connectivity of the shortest path ShortestPath currently found. .
[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 according to the path connectivity value at this time, and find out whether there is a shortest path with connectivity greater than or equal to the path connectivity value at this time.
[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 the v' node is all nodes whose CN values are greater than or equal to the path connectivity value, that is, only the neighbor nodes whose CN values are 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 can be found. Set the upper limit of the path connectivity to maxPathCN = 4, which is the upper limit of the path connectivity in subsequent steps.
[0108] Step 4: Use the binary search 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 of 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, then 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 2 of this path, which is the high connectivity shortest impact 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. Since there is 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 influence paths of the same length on two nodes, but the connectivity value of one of the paths is larger, then the market promotion of the nodes of 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, and help enterprises or governments 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 impact path between users. Specifically: the method for querying the highly connected shortest impact 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 according to the index linked list data structure, the starting node, and the target node to determine the highly connected shortest impact path; the path application link is used to disseminate information through the highly connected shortest impact path. The method for querying the highly connected shortest impact 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, referred to as I / O) and a communication interface. The processor, the memory and the 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 the 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, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0118] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0119] In an exemplary embodiment, a computer program product is provided, including a computer program, and 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 of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed 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 the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can 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 can 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 database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.
[0123] The technical features of the above embodiments may 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 article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will 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 according to 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 to each other; 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 an 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; According to the lower bound value of the path connectivity at the last iteration number, the path connectivity value at the current iteration number is determined, and the step of "according to the given path connectivity value, and according to the index linked list data structure, the starting node, and the target node, whether the shortest impact path that satisfies the given path connectivity value can be obtained" is called; wherein the given path connectivity value is the path connectivity value at the current iteration number; when the current iteration number is equal to 1, the lower bound value of the path connectivity at the last iteration number is set to 1; If so, calculate the shortest impact path under the current iteration number and the path connectivity value corresponding to the shortest impact 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 impact path under the current iteration number, return to 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 step "according to the given path connectivity value, and according to the index linked list data structure, the starting node, and the target node, determine whether the shortest impact path that satisfies the given path connectivity value can be obtained"; If not, the upper limit value of the path connectivity at the previous iteration number is updated to the path connectivity value at the current iteration number to obtain the search range of the path connectivity value; According to the lower limit value of the path connectivity and the upper limit value of the path connectivity at the last iteration number, the iteration is continued 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: According to the lower limit value of the path connectivity and the upper limit value of the path connectivity under the last iteration number, the iteration is continued until the high-connectivity shortest impact path is determined, specifically including: Determine the intermediate value of the path connectivity at the current number of iterations according to the lower bound value and the upper bound value of the path connectivity at the previous number of iterations, then update the path connectivity value at the current number of iterations to the intermediate value of the path connectivity at the current number of iterations, and call the step of "determining whether the shortest impact path that satisfies 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", to obtain a first judgment result; If the first judgment result is yes, then calculate the shortest impact path under the current iteration number and the path connectivity value corresponding to the shortest impact path under the current iteration number, and update the path connectivity lower limit value under the previous iteration number to the path connectivity value corresponding to the shortest impact path under the current iteration number; then judge whether the difference between the path connectivity lower limit value and the path connectivity upper limit value under the previous iteration number is 1, and obtain the second judgment result; 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 high-connectivity shortest influence path; If the second judgment result is no, then return to the step "determine the path connectivity intermediate value at the current iteration number according to 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 intermediate value at the current iteration number, and call the step "according to the given path connectivity value, and according to the index linked list data structure, the starting node, and the target node, determine whether the shortest impact path that satisfies the given path connectivity value can be obtained", and obtain the first judgment result"; 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 at 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; 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 third judgment result is no, return to the step "determine the intermediate value of the path connectivity at the current number of iterations based on the lower limit value of the path connectivity and the upper limit value of the path connectivity at the previous number of iterations, and then update the path connectivity value at the current number of iterations to the intermediate value of the path connectivity at the current number of iterations, 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 satisfies the given path connectivity value can be obtained"".
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, it is determined whether a shortest impact path that satisfies the given path connectivity value can be obtained, specifically including: 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 via 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, which may be a v' node; the third state variable CN_P(w) represents a 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 an updated initial set; Traverse the index linked list data structure of the v' node to determine whether the single-hop connectivity value of the v' node is greater than or equal to the given path connectivity value; Wherein, when the single-hop connectivity value of the v' node is greater than or equal to the given path connectivity value, a neighbor node whose single-hop connectivity value with the v' node is greater than or equal to the given path connectivity value is obtained, and the state variable is updated; return to the step of "selecting the v' node with the minimum value of the first state variable D(w) in the current stage to add to the initial set", until all the 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 ∞; 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, and 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; 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 number is determined according to the lower bound value of the path connectivity at the previous iteration number, specifically including: The value obtained by doubling the lower limit of path connectivity under the previous iteration number is determined as the upper limit 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 variable specifically includes: Update the first state variable D(w) according to the following formula: D(w)=min(D(w),D(v')+1); Wherein, D(v') represents the shortest path length of 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 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.
6. The method for querying the shortest influential path of 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 executable on the processor, wherein the processor executes the computer program to implement the method for querying the shortest influential path with high connectivity between users as described in 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 described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Value domain-based query method and apparatus
CN111459979A
Social network maximum influence node selection method based on geographic area
CN111782969A
Optimal ordered path query method based on interest point preference
CN112507047A
Time sequence driving circuit division method
CN115221821A
Method and device for sending and receiving path information
CN115344748A