A method and system for large-scale graph triangle counting based on local differential privacy
By performing a local differential privacy random walk algorithm on a large-scale graph, the target subgraph is generated and the 2-star structure and node degree are estimated. This solves the problems of high computational complexity and insufficient security, and achieves high-precision triangle estimation, satisfying user privacy protection and low-cost computation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-18
- Publication Date
- 2026-07-24
AI Technical Summary
When calculating the number of triangles in a large-scale graph, existing technologies suffer from high computational complexity and insufficient security. In particular, while maintaining local differential privacy, direct calculation is too time-consuming and cannot effectively protect the graph's topology from being leaked.
By constructing a target graph, setting the local differential privacy coefficient and the number of random walk steps, executing a graph random walk algorithm that satisfies local differential privacy, generating a target subgraph that satisfies differential privacy conditions, and recording the set of nodes and edges during the walk, and combining the 2-star structure and node degree estimates, the estimated value of the total number of triangles is calculated.
It enables high-precision estimation of the number of triangles in a large-scale graph without requiring observation of the entire graph's topology, ensuring user data privacy and reducing computational costs.
Smart Images

Figure CN122453703A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of differential privacy, and more particularly to a method and system for counting triangles in a large-scale graph based on local differential privacy. Background Technology
[0002] Calculation graph The number of triangles in a distribution network is a classic problem in graph theory computation. In assessing the reliability of distribution networks, a triangle represents a single line disconnection that does not lead to islanding. The statistical count of triangles in a distribution network can reflect local power supply reliability. However, publishing the number of triangles in a distribution network raises security concerns regarding the network topology. Therefore, it is necessary to consider calculating the number of triangles in a large-scale graph while maintaining local differential privacy, thereby measuring the power supply resilience of the distribution network.
[0003] However, calculating a having The number of triangles on a graph with nodes needs to be determined. The computational complexity is too high. When the number of nodes in the graph increases significantly, direct computation takes too long. On the other hand, avoiding communication between nodes during direct computation is an important prerequisite for maintaining local differential privacy. Summary of the Invention
[0004] In view of the aforementioned existing problems, this invention is proposed. Therefore, this invention provides a large-scale graph triangle counting method and system based on local differential privacy to solve the problems of poor security and long computation time in existing calculation methods.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution: In a first aspect, embodiments of the present invention provide a method for counting large-scale graph triangles based on local differential privacy, comprising: Construct the target graph to be processed, and set the local differential privacy coefficient and the number of random walk steps; A graph random walk algorithm that satisfies local differential privacy is executed. Without obtaining the full graph topology, a target subgraph that satisfies differential privacy is generated by sampling from the target graph, and the set of nodes and edges traversed during the walk is recorded. Based on the target subgraph and the set of edges recorded, calculate the estimated number of 2-star structures in the target graph, and calculate the estimated degree of the nodes in the graph; By combining the estimated number of 2-star structures, the estimated degree of nodes, and the estimated number of edges in the graph, the estimated total number of triangles in the target graph is calculated.
[0006] As a preferred embodiment of the large-scale graph triangle counting method based on local differential privacy described in this invention, wherein: the execution of the graph random walk algorithm satisfying local differential privacy includes: In the target image of A starting node is randomly selected from the nodes according to a uniform distribution. Obtain the connection vector of the node after processing by the local differential privacy algorithm; For any number of steps, based on the current node The connection vector is used to select the next node using a local differential privacy algorithm with random walk on the graph. And record the edge selected this time. ; If node If it has never been visited, then visit the node. Request and retrieve its connection vector after processing by the randomized response algorithm, and then set the node Add the node to the set of visited nodes, and select the next node according to a uniform distribution. If node If a node has already been visited, the next node is selected based on the currently known information in a uniform distribution. Output the set of all recorded edges as the target subgraph. The set of edges and the set of all visited nodes.
[0007] As a preferred embodiment of the large-scale graph triangle counting method based on local differential privacy described in this invention, the process of the local differential privacy algorithm processing the connection vector includes: Set local differential privacy factor Initialization parameters The set of points that store the random walk path. For the input connection vector Output the perturbated connection vector The original value of 1 indicates that an edge exists, and the original value of 0 indicates that an edge does not exist. when At that time, for each element in the vector With probability Reverse the original value, let In other cases, keep the original value unchanged, let ;in, For nodes The corresponding connection vector, For nodes Connection vectors processed by a local differential privacy algorithm; like And nodes It has already been visited, that is... Then directly call the node. Connection vectors already processed by local differential privacy algorithm ; like and Never been visited, i.e. Nodes are generated according to the following rules. The corresponding connection vector conforming to differential privacy : like Then let ; like Then based on probability Reverse the original value, let ,in, For connection vectors The Each element; under other probabilities, its original value remains unchanged, let ; Node Add to the set of visited nodes ,make .
[0008] As a preferred embodiment of the large-scale graph triangle counting method based on local differential privacy described in this invention, the calculation of the estimated number of 2-star structures in the target graph includes: According to the probability distribution from the target subgraph Recorded edge set Select an edge , where the selected edge The probability is proportional to its degree; According to the edge degree information According to a uniform distribution from and Choose another edge from adjacent edges. Determine if the edge is and edge The 2-star structure Does it meet the preset conditions? like If so, then the 2-star structure is determined to belong to a valid set, and the counting variable is set to... Otherwise, let ; Calculate the average count for all steps. Based on sets and mixed parameters Calculate the intermediate correction factor Output an estimate of the number of 2-star structures, calculated using the following formula: in, For parameters related to the random walk path, For set The degree statistics.
[0009] As a preferred embodiment of the large-scale graph triangle counting method based on local differential privacy described in this invention, the calculation of the degree estimate of a node in the graph includes: For nodes that have been visited, calculate their degree based on their connection vectors after randomization of the response; for nodes that have not been directly visited but exist in the set of recorded edges... If node Then directly based on the node Calculate the degree of the connection vector; if the node Then for the node The original connection to The perturbation vector is obtained by applying the randomized response algorithm. .
[0010] As a preferred embodiment of the large-scale graph triangle counting method based on local differential privacy described in this invention, it further includes: compute nodes The degree is expressed as: The first item represents a node. The number of connections between a node and the set of unvisited nodes is counted, with the second term representing the node's connection count. Statistical count of connections to the set of visited nodes; Output the calculated node degree .
[0011] As a preferred embodiment of the large-scale graph triangle counting method based on local differential privacy described in this invention, the total number of triangles in the target graph is estimated by combining the number estimate of the 2-star structure, the degree estimate of the nodes, and the edge estimate of the graph; wherein the calculation of the estimated total number of triangles in the target graph is expressed as follows: in, For target image The total number of nodes, This refers to the flip probability in the randomized response algorithm. from The number of combinations of selecting 3 from 3 nodes.
[0012] Secondly, the present invention provides a large-scale graph triangle counting system based on local differential privacy, comprising: The data acquisition module is used to construct the target graph to be processed and receive privacy-processed connection vectors from the nodes. The random walk processing module is used to execute a graph random walk algorithm that satisfies local differential privacy and generate target subgraph data; The statistics calculation module is used to calculate the estimated number of 2-star structures and the estimated degree of nodes based on the target subgraph data; The triangle counting and publishing module is used to combine statistical calculation results, use an unbiased estimation algorithm to obtain an estimate of the total number of triangles, and then output it.
[0013] Thirdly, the present invention provides an electronic device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the large-scale graph triangle counting method based on local differential privacy.
[0014] Fourthly, the present invention provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the large-scale graph triangle counting method based on local differential privacy.
[0015] Compared with the prior art, the beneficial effects of the present invention are: the method of the present invention does not require observation of the entire map, that is, under the premise of ensuring user data privacy, it can achieve high-precision estimation of the number of triangles in a large-scale map with low computational cost. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1 This is a schematic diagram of the process flow of a large-scale graph triangle counting method based on local differential privacy, according to an embodiment of the present invention. Detailed Implementation
[0017] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0018] Example 1, referring to Figure 1 This is one embodiment of the present invention, which provides a large-scale graph triangle counting method based on local differential privacy, comprising: S100: Construct the target graph to be processed, and set the local differential privacy coefficient and the number of random walk steps; S200: Execute a graph random walk algorithm that satisfies local differential privacy. Without obtaining the topology of the entire graph, sample from the target graph to generate a target subgraph that satisfies the differential privacy condition, and record the set of nodes and edges visited during the walk. S300: Based on the target subgraph and the set of edges of the records, calculate the estimated number of 2-star structures in the target graph and the estimated degree of the nodes in the graph; S400: By combining the quantity estimate of the 2-star structure, the degree estimate of the nodes, and the edge estimate of the graph, the estimated total number of triangles in the target graph is calculated.
[0019] It should be noted that while existing calculation methods can estimate the number of triangles in a graph without observing the entire graph, they fail to meet the premise of local differential privacy, resulting in poor algorithm security and failing to protect the graph's topology from being stolen by third parties who obtain the number of triangles. Other calculation methods, while capable of determining the number of triangles under local differential privacy conditions, require information about the entire graph; therefore, when the graph is large, these algorithms are computationally time-consuming. This invention provides a method that satisfies local differential privacy conditions and enables random walks on a graph. This method allows for random walks under local differential privacy conditions without involving information exchange between points on the graph. Furthermore, it provides an algorithm for calculating 2-star structures based on this random walk and a method for estimating the number of triangles in a graph based on random walks under local differential privacy conditions. This method achieves high-precision estimation of the number of triangles in large-scale graphs without observing the entire graph, thus ensuring user data privacy and with low computational cost.
[0020] Furthermore, in step S100, the target map to be processed is constructed. ,in, Let be the set of points in the graph. Let be the set of edges in the graph.
[0021] Furthermore, regarding a random walk The number of steps to walk is defined as .
[0022] For any graph Define each point on the graph. The degree is based on The number of edges at the endpoints. For any edge... Define edge The degree is ,in For the edge The two endpoints.
[0023] Define a 2-star for any point There are edges This makes their common endpoints all That is to say, it is believed This forms a 2-star.
[0024] Define an algorithm To satisfy local differential privacy, then for the differential privacy coefficient... If and only if for any two graphs ,in ,but in, These are the target images. Corresponding link matrix , The A line is equivalent to a point graph. midpoint and The connection vector.
[0025] In this embodiment of the invention, step S200 involves executing a graph-based random walk algorithm that satisfies local differential privacy, including: In the target image of A starting node is randomly selected from the nodes according to a uniform distribution. Obtain the connection vector of the node after processing by the local differential privacy algorithm; For any number of steps, based on the current node The connection vector is used to select the next node using a local differential privacy algorithm with random walk on the graph. And record the edge selected this time. ; If node If it has never been visited, then visit the node. Request and retrieve its connection vector after processing by the randomized response algorithm, and then set the node Add the node to the set of visited nodes, and select the next node according to a uniform distribution. If node If a node has already been visited, the next node is selected based on the currently known information in a uniform distribution. Output the set of all recorded edges as the target subgraph. The set of edges and the set of all visited nodes.
[0026] In this embodiment of the invention, the process of the local differential privacy algorithm processing the connection vector in step S200 includes: Set local differential privacy factor Initialization parameters The set of points that store the random walk path. For the input connection vector Output the perturbated connection vector The original value of 1 indicates that an edge exists, and the original value of 0 indicates that an edge does not exist. when At that time, for each element in the vector With probability Reverse the original value, let In other cases, keep the original value unchanged, let ;in, For nodes The corresponding connection vector, For nodes Connection vectors processed by a local differential privacy algorithm; like And nodes It has already been visited, that is... Then directly call the node. Connection vectors already processed by local differential privacy algorithm ; like and Never been visited, i.e. Nodes are generated according to the following rules. The corresponding connection vector conforming to differential privacy : like Then let ; like Then, based on probability Reverse the original value, let ,in, For connection vectors The Each element; under other probabilities, its original value remains unchanged, let ; Node Add to the set of visited nodes ,make .
[0027] Furthermore, the random walk algorithm designed in this embodiment of the invention satisfies the definition of local differential privacy. It can estimate the number of triangles in a graph without knowing the information of the entire graph, and the algorithm meets the requirements of local differential privacy protection.
[0028] In an optional embodiment, a random walk algorithm that satisfies the local differential privacy definition is used. The implementation steps include: Input: A fixed number of steps random walk ,picture The number of points , and a with Random response algorithm with parameters A set recording the travel path points The set of edges ,make The initial value is 0; exist Among the points, select one point according to a uniform distribution. At the same time, this point provides feedback to someone who has experienced it. Processed connection vectors .
[0029] For any Repeat the following steps: Based on the connection vector Use a uniform distribution to select the next point. And record the edge selected this time. ,Will Included ; if , Immediately If it has never been visited, then visit. ,Require Feedback on the corresponding process Processed connection vectors At the same time Included In the middle, order ; Otherwise, just follow The connection vector after processing by the local differential privacy algorithm Choose the next point if the distribution is uniform.
[0030] Output: The set of edges for all records and .
[0031] In this embodiment of the invention, step S300, which calculates the estimated number of 2-star structures in the target image, includes: According to the probability distribution from the target subgraph Recorded edge set Select an edge , where the selected edge The probability is proportional to its degree; According to the edge degree information According to a uniform distribution from and Choose another edge from adjacent edges. Determine if the edge is and edge The 2-star structure Does it meet the preset conditions? like If so, then the 2-star structure is determined to belong to a valid set, and the counting variable is set to... Otherwise, let ; Calculate the average count for all steps. Based on sets and mixed parameters Calculate the intermediate correction factor Output an estimate of the number of 2-star structures, calculated using the following formula: in, For parameters related to the random walk path, For set The degree statistics.
[0032] It should be noted that the 2-star algorithm in the estimation diagram is used. Degree algorithm of a point This algorithm achieves the estimation of triangles on a graph. .
[0033] In an optional embodiment, a method for estimating the number of 2-stars on a graph while satisfying local differential privacy conditions. The implementation steps include: Input: Image A random walk on the graph and the set of edges traversed according to its corresponding records. ,algorithm .
[0034] For steps According to probability distribution ,choose one edge in , where the selected edge The probability is: Choose according to the edge degree Choose an edge according to a uniform distribution .
[0035] If the corresponding 2-star belong ,Right now Then count Otherwise, calculate .
[0036] make: ;calculate ,in This represents the set of edges traversed in the random walk record. yes The mixed parameters set in the middle.
[0037] Output: ,in, yes The degree of all edges in the middle. It is the target subgraph The above is an estimate of the number of 2-stars.
[0038] In this embodiment of the invention, step S300, calculating the degree estimate of the nodes in the graph, includes: For nodes that have been visited, calculate their degree based on their connection vectors after randomization of the response; for nodes that have not been directly visited but exist in the set of recorded edges... If node Then directly based on the node Calculate the degree of the connection vector; if the node Then for the node The original connection to The perturbation vector is obtained by applying the randomized response algorithm. .
[0039] In this embodiment of the invention, step S300 further includes: compute nodes The degree is expressed as: The first item represents a node. The number of connections between a node and the set of unvisited nodes is counted, with the second term representing the node's connection count. Statistical count of connections to the set of visited nodes; Output the calculated node degree .
[0040] In an optional embodiment, an algorithm for calculating the degree of a point in the graph under the premise of random walk. The implementation steps include: enter: The set of points collected after a random walk: .
[0041] If point Then directly based on the point Calculate the degree of the connection vector.
[0042] if ,So, calculate .
[0043] Calculate this point The degree is: Output: .
[0044] In an optional embodiment, a local differential privacy-preserving algorithm for estimating the number of triangles on a graph is used. The implementation steps include: Input: A random walk ,algorithm Local differential privacy coefficient ; Based on algorithm Running the algorithm Perform a random walk on the map to obtain the original map. A subgraph that satisfies differential privacy conditions .
[0045] Will Input Algorithm Output Estimation of the number of upper triangles When running When you need to calculate the degree of a point in a graph, you can call an algorithm. .
[0046] Will Input Algorithm Output Estimation of the number above When running When you need to calculate the degree of a point in a graph, you can call an algorithm. .
[0047] Will Input Algorithm Output Estimation of the number of 2-stars When running When you need to calculate the degree of a point in a graph, you can call an algorithm. .
[0048] Output: Estimated number of triangles in the graph under local differential privacy conditions. .
[0049] It should be noted that, The input is a graph A random walk Its output is an estimate of the number of triangles. .algorithm The input is a subset of edges. The output is an estimate of the number of edges in the graph. .
[0050] It should also be noted that, due to the algorithm used... This is an algorithm that satisfies local differential privacy requirements. Based on the post-processing properties, subsequent algorithms built upon it all possess local differential privacy requirements. The algorithm itself is implemented on a graph and does not involve points. Random walk under the premise of information exchange between them And the degree calculation for each point based on this. The algorithm is easily proven from its content. This invention's algorithm achieves the estimation of the number of 2-stars in a graph without requiring knowledge of the graph's topology. .
[0051] In this embodiment of the invention, step S400 combines the estimated number of 2-star structures, the estimated degree of nodes, and the estimated number of edges in the graph to calculate an estimated value for the total number of triangles in the target graph; wherein the calculation of the estimated value for the total number of triangles in the target graph is expressed as follows: in, For target image The total number of nodes, This refers to the flip probability in the randomized response algorithm. from The number of combinations of selecting 3 from 3 nodes.
[0052] It should be noted that, by performing random walks on the graph, this embodiment of the invention achieves the estimation of the number of triangles in the graph without requiring knowledge of the full graph's topology. This algorithm... Finally, an unbiased estimate of the number of triangles in the graph is given. The algorithm output is shown in the graph. An unbiased estimate of the upper triangle.
[0053] Specifically, the algorithm The output is a graph Unbiased estimator of the upper triangle.
[0054] For any graph connection matrix In other words, the number of its triangles is . because The probability of experiencing each edge is The "flip" obtained Therefore, the unbiased estimate of each edge is: Therefore, it is easy to obtain graph-based ,picture Unbiased estimate of the number of upper triangles for: That is: in, To perform a random walk that satisfies local differential privacy The corresponding target subgraph The first in the connection matrix Okay, number Column elements, others , The definition is similar. in For local differential privacy parameters, It is the target image. The number of dots.
[0055] Furthermore, due to: picture The number of 2-stars is: picture The number of items above is: .
[0056] In summary, the algorithm output is an unbiased estimate.
[0057] It should be noted that the method of the present invention can perform random walks under local differential privacy conditions without involving information interaction between points on the graph. Furthermore, it provides an algorithm for calculating 2-star structures based on this random walk and an estimation method for the number of triangles on the graph based on random walks under local differential privacy conditions. It does not require observation of the entire graph, that is, it can achieve high-precision estimation of the number of triangles in a large-scale graph with low computational cost while ensuring user data privacy.
[0058] In one feasible approach, assessing the resilience of the power grid distribution network can be done by viewing the entire distribution network structure as a diagram. Points on the map It can be viewed as a busbar, edge This can be viewed as a transmission line. The robustness of the distribution network structure is assessed by ensuring that a loop connection still exists between any two points (busbars) when the transmission line between them is disconnected (short circuit or maintenance). This can be considered a calculation diagram. The number of triangles in the circuit. This is equivalent to the fact that the more triangles in the circuit, the more robust the distribution network.
[0059] It is worth noting that, in order to measure the resilience of the distribution network in a region, it is necessary to accurately calculate the corresponding diagrams of the distribution network. The number of triangles in the diagram. In actual assessment, on the one hand, due to the large scale of power distribution network construction and frequent changes in the grid structure, directly calculating the number of triangles on the diagram is time-consuming. On the other hand, publishing the number of triangles in the grid can be used to infer the grid structure, posing a risk to enterprise information security. This invention, through a random walk on the diagram, allows for calculation without needing to understand the entire diagram. Under the premise of information, it enables the estimation of the number of triangles on the graph based on local differential privacy, which provides support for assessing the robustness of the power distribution network and the security of published data.
[0060] Example 2 is an embodiment of the present invention. This embodiment differs from the first embodiment in that it provides a large-scale graph triangle counting system based on local differential privacy, comprising: The data acquisition module is used to construct the target graph to be processed and receive privacy-processed connection vectors from the nodes. The random walk processing module is used to execute a graph random walk algorithm that satisfies local differential privacy and generate target subgraph data; The statistics calculation module is used to calculate the estimated number of 2-star structures and the estimated degree of nodes based on the target subgraph data; The triangle counting and publishing module is used to combine statistical calculation results, use an unbiased estimation algorithm to obtain an estimate of the total number of triangles, and then output it.
[0061] Specifically, each module of the large-scale graph triangle counting system based on local differential privacy in this embodiment implements the steps of the large-scale graph triangle counting method based on local differential privacy in Embodiment 1 during execution, for example: In one implementation, a large-scale graph triangle counting system based on local differential privacy can perform the following steps: In the target image of A starting node is randomly selected from the nodes according to a uniform distribution. Obtain the connection vector of the node after processing by the local differential privacy algorithm; For any number of steps taken, based on the current historical node The connection vector is used to select the next node using a local differential privacy algorithm with random walk on the graph. And record the edge selected this time. ; If node If a node has already been visited, then visit that node. Request and obtain its connection vector after processing by the local differential privacy algorithm, and then set the node Add the node to the set of visited nodes, and select the next node according to a uniform distribution. If node If a node has not been visited, the next node is selected based on the currently known information in a uniform distribution. node The corresponding connection vector conforming to differential privacy The generation rules include: when At that time, for each element in the vector With probability Reverse the original value, let In other cases, keep the original value unchanged, let ;in, For nodes The corresponding connection vector, For nodes Connection vectors processed by a local differential privacy algorithm; like And nodes It has already been visited, that is... Then directly call the node. Connection vectors already processed by local differential privacy algorithm ; like and Never been visited, i.e. Then nodes are generated according to the following rules. The corresponding connection vector conforming to differential privacy : like Then let ; like Then, based on probability Reverse the original value, let ,in, For connection vectors The Each element; under other probabilities, its original value remains unchanged, let ; Node Add to the set of visited nodes ,make .
[0062] According to the probability distribution from the target subgraph Recorded edge set Select an edge , where the selected edge The probability is proportional to its degree; According to the edge degree information According to a uniform distribution from and Choose another edge from adjacent edges. Determine if the edge is and edge The 2-star structure Does it meet the preset conditions? like If so, then the 2-star structure is determined to belong to a valid set, and the counting variable is set to... Otherwise, let ; Calculate the average count for all steps. Based on sets and mixed parameters Calculate the intermediate correction factor Output an estimate of the number of 2-star structures, calculated using the following formula: in, For parameters related to the random walk path, For set The degree statistics.
[0063] For nodes that have been visited, calculate their degree based on their connection vectors after randomization of the response; for nodes that have not been directly visited but exist in the set of recorded edges... If node Then directly based on the node Calculate the degree of the connection vector; if the node Then for the node The original connection to The perturbation vector is obtained by applying the randomized response algorithm. .
[0064] compute nodes The degree is expressed as: The first item represents a node. The number of connections between a node and the set of unvisited nodes is counted, with the second term representing the node's connection count. Statistical count of connections to the set of visited nodes; Output the calculated node degree .
[0065] The estimated value of the total number of triangles in the target image is expressed as follows: in, For target image The total number of nodes, This refers to the flip probability in the randomized response algorithm. from The number of combinations of selecting 3 nodes from 3 nodes.
[0066] This embodiment also provides an electronic device applicable to large-scale graph triangle counting methods based on local differential privacy, including: The memory and processor are used to store computer-executable instructions and execute the computer-executable instructions to implement the large-scale graph triangle counting method based on local differential privacy as proposed in the above embodiments.
[0067] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, it implements the large-scale graph triangle counting method based on local differential privacy as proposed in the above embodiments.
[0068] The storage medium proposed in this embodiment and the method for implementing large-scale graph triangle counting based on local differential privacy proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0069] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.
[0070] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for counting triangles in a large-scale graph based on local differential privacy, characterized in that, include: Construct the target graph to be processed, and set the local differential privacy coefficient and the number of random walk steps; A graph random walk algorithm that satisfies local differential privacy is executed. Without obtaining the full graph topology, a target subgraph that satisfies differential privacy is generated by sampling from the target graph, and the set of nodes and edges traversed during the walk is recorded. Based on the target subgraph and the set of edges recorded, calculate the estimated number of 2-star structures in the target graph, and calculate the estimated degree of the nodes in the graph; By combining the estimated number of 2-star structures, the estimated degree of nodes, and the estimated number of edges in the graph, the estimated total number of triangles in the target graph is calculated.
2. The large-scale graph triangle counting method based on local differential privacy as described in claim 1, characterized in that, The execution of the graph random walk algorithm that satisfies local differential privacy includes: In the target image of A starting node is randomly selected from the nodes according to a uniform distribution. Obtain the connection vector of the node after processing by the local differential privacy algorithm; For any number of steps, based on the current node The connection vector is used to select the next node using a local differential privacy algorithm with random walk on the graph. And record the edge selected this time. ; If node If it has never been visited, then visit the node. Request and retrieve its connection vector after processing by the randomized response algorithm, and then set the node Add the node to the set of visited nodes, and select the next node according to a uniform distribution. If node If a node has already been visited, the next node is selected based on the currently known information in a uniform distribution. Output the set of all recorded edges as the target subgraph. The set of edges and the set of all visited nodes.
3. The large-scale graph triangle counting method based on local differential privacy as described in claim 2, characterized in that, The process of processing the join vector by the local differential privacy algorithm includes: Set local differential privacy factor Initialization parameters The set of points that store the random walk path For the input connection vector Output the perturbated connection vector The original value of 1 indicates that an edge exists, and the original value of 0 indicates that an edge does not exist. when At that time, for each element in the vector With probability Reverse the original value, let In other cases, keep the original value unchanged, let ;in, For nodes The corresponding connection vector, For nodes Connection vectors processed by a local differential privacy algorithm; like And nodes It has already been visited, that is... Then directly call the node. Connection vectors already processed by local differential privacy algorithm ; like and Never been visited, i.e. Nodes are generated according to the following rules. The corresponding connection vector conforming to differential privacy : like Then let ; like Then based on probability Reverse the original value, let ,in, For connection vectors The Each element; under other probabilities, its original value remains unchanged, let ; Node Add to the set of visited nodes ,make .
4. The large-scale graph triangle counting method based on local differential privacy as described in claim 3, characterized in that, Calculate the estimated number of 2-star structures in the target image, including: From the target subgraph according to the probability distribution Recorded edge set Select an edge , where the selected edge The probability of it is proportional to its degree. According to the edge degree information According to a uniform distribution from and Choose another edge from adjacent edges. Determine if the edge is and edge The 2-star structure Does it meet the preset conditions? like If so, then the 2-star structure is determined to belong to a valid set, and the counting variable is set to... Otherwise, let ; Calculate the average count for all steps. Based on sets and mixed parameters Calculate the intermediate correction factor Output an estimate of the number of 2-star structures, calculated using the following formula: in, For parameters related to the random walk path, For set The degree statistics.
5. The large-scale graph triangle counting method based on local differential privacy as described in claim 4, characterized in that, The calculation of the degree estimate of a node in the graph includes: For nodes that have been visited, calculate their degree based on their connection vectors after randomization of the response; for nodes that have not been directly visited but exist in the set of recorded edges... If node Then directly based on the node Calculate the degree of the connection vector; if the node Then for the node The original connection to The perturbation vector is obtained by applying the randomized response algorithm. .
6. The large-scale graph triangle counting method based on local differential privacy as described in claim 5, characterized in that, Also includes: compute nodes The degree is expressed as: The first item represents a node. The number of connections between a node and the set of unvisited nodes is counted, with the second term representing the node's connection count. Statistical count of connections to the set of visited nodes; Output the calculated node degree .
7. The large-scale graph triangle counting method based on local differential privacy as described in claim 6, characterized in that, Combining the estimated number of 2-star structures, the estimated degree of nodes, and the estimated number of edges in the graph, an estimated total number of triangles in the target graph is calculated; the calculation of the estimated total number of triangles in the target graph is expressed as follows: in, For target image The total number of nodes, This refers to the flip probability in the randomized response algorithm. from The number of combinations of selecting 3 nodes from 3 nodes.
8. A large-scale graph triangle counting system based on local differential privacy, applied to the method described in any one of claims 1-7, characterized in that, include: The data acquisition module is used to construct the target graph to be processed and receive privacy-processed connection vectors from the nodes. The random walk processing module is used to execute a graph random walk algorithm that satisfies local differential privacy and generate target subgraph data; The statistics calculation module is used to calculate the estimated number of 2-star structures and the estimated degree of nodes based on the target subgraph data; The triangle counting and publishing module is used to combine statistical calculation results, use an unbiased estimation algorithm to obtain an estimate of the total number of triangles, and then output it.
9. An electronic device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the large-scale graph triangle counting method based on local differential privacy as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the large-scale graph triangle counting method based on local differential privacy as described in any one of claims 1 to 7.