Guard node set generation method and device based on K-Medoids algorithm in anonymous communication
The K-Medoids algorithm is used to calculate the number of bandwidth units and clusters, select the initial centroid, and perform clustering operations. This solves the problem of insufficient bandwidth similarity in the generation process of guard node sets in anonymous communication and improves the quality of node sets.
Patent Information
- Application Number
- CN202310313972.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-03-28
AI Technical Summary
The existing guard node set generation algorithm in anonymous communication is difficult to ensure the similarity of node bandwidth during the generation process, which affects the quality of the node set, especially when the number of backup guard nodes is small.
The K-Medoids algorithm is used to calculate the bandwidth unit and the number of clusters of the backup guard nodes, select the initial centroid, and perform clustering operations to generate a set of guard nodes with bandwidth similarity.
It effectively ensures the similarity of node bandwidth in the generated node set, ensures that the node set meets the system usage requirements, and improves the quality of node set generation.
Smart Images

Figure CN118740397A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method and device for generating a guard node set based on a K-Medoids algorithm in anonymous communication. Background Art
[0002] In anonymous communication, according to the design requirements of the guard node set, the bandwidth size of each node in the node set should be roughly similar, and the higher the similarity of the bandwidth of each node, the better the quality of the node set. In the original scheme of the guard node set, the generation algorithm of the node set only arranges the backup guard nodes in descending order according to the bandwidth size, iteratively selects and accumulates the node bandwidth units until the total bandwidth of the selected nodes meets the bandwidth generation threshold of the guard node set, and the selected backup guard nodes are formed into a node set and added to the network. The algorithm is relatively simple and does not evaluate the quality of the generated guard node set. In the initial generation process of the guard node set, due to the large number of nodes and the relatively uniform distribution of node bandwidth, the original generation algorithm can ensure that the bandwidth of the nodes in the generated node set has good similarity. However, in the subsequent generation process, due to the small number of backup guard nodes in the network, it is difficult to ensure that the bandwidth size of these nodes is in a relatively ideal distribution range, which may greatly affect the generation quality of the node set. Summary of the invention
[0003] The purpose of the embodiment of the present invention is to provide a method and device for generating a guard node set based on the K-Medoids algorithm in anonymous communication, which can effectively ensure the similarity of node bandwidth in the generated node set.
[0004] In order to achieve the above-mentioned purpose, an embodiment of the present invention provides a guard node set generation method based on the K-Medoids algorithm in anonymous communication, the method comprising: judging whether the total bandwidth and the number of nodes of the backup guard nodes meet the generation condition of the guard node set; when the generation condition of the guard node set is met, obtaining the bandwidth values of all the backup guard nodes and generating a bandwidth data set; calculating the bandwidth unit of each backup guard node according to the bandwidth data set; judging whether the bandwidth unit of each backup guard node is equal to the bandwidth value, and when the bandwidth unit is not equal to the bandwidth value, using the bandwidth unit to replace the bandwidth value in the bandwidth data set; calculating the number of clusters of each backup node according to the bandwidth of each backup node and the bandwidth generation threshold of the guard node set; selecting an initial centroid; performing a clustering operation based on the K-Medoids algorithm according to the number of clusters and the initial centroid; generating a guard node set according to the total bandwidth of each clustering result.
[0005] Preferably, the generating a threshold value according to the bandwidth of each standby node and the bandwidth of the guard node set, and calculating the number of clusters of each standby node comprises: calculating the number of clusters of each standby node by the following formula:
[0006]
[0007]
[0008] Among them, Threshold BW Generates a threshold for the bandwidth of the guard node set, bw_b i is the bandwidth of each standby node, N k is the number of clusters of each standby node.
[0009] Preferably, the selecting of the initial centroid includes: performing a deduplication operation on the backup guard node data set to generate an initial centroid set; and selecting the initial centroid based on the initial centroid set.
[0010] Preferably, selecting the initial centroid according to the initial centroid set comprises: selecting the initial centroid by the following formula:
[0011]
[0012] Among them, i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N k -1, interval is the sampling interval.
[0013] The embodiment of the present invention also provides a guard node set generation device based on the K-Medoids algorithm in anonymous communication, the device comprising: a bandwidth data set generation unit, a bandwidth unit determination unit, a parameter calculation unit and a guard node set generation unit, wherein the bandwidth data set generation unit is used to: determine whether the total bandwidth and the number of nodes of the standby guard node meet the generation condition of the guard node set; when the generation condition of the guard node set is met, obtain the bandwidth values of all the standby guard nodes to generate a bandwidth data set; the bandwidth unit determination unit is used to: calculate the bandwidth unit of each standby guard node according to the bandwidth data set; determine whether the bandwidth unit of each standby guard node is equal to the bandwidth value, and when the bandwidth unit is not equal to the bandwidth value, use the bandwidth unit to replace the bandwidth value in the bandwidth data set; the parameter calculation unit is used to: calculate the number of clusters about each standby node according to the bandwidth of each standby node and the bandwidth generation threshold of the guard node set; select an initial centroid; the guard node set generation unit is used to: perform clustering operations based on the K-Medoids algorithm according to the number of clusters and the initial centroid; and generate a guard node set according to the total bandwidth of each clustering result.
[0014] Preferably, the parameter calculation unit is used to calculate the number of clusters of each standby node by the following formula:
[0015]
[0016]
[0017] Among them, Threshold BW Generates a threshold for the bandwidth of the guard node set, bw_b i is the bandwidth of each standby node, N k is the number of clusters of each standby node.
[0018] Preferably, the parameter calculation unit is used to: perform a deduplication operation on the backup guard node data set to generate an initial centroid set; and select an initial centroid based on the initial centroid set.
[0019] Preferably, the parameter calculation unit is used to select the initial centroid by the following formula:
[0020]
[0021] Among them, i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N k -1, interval is the sampling interval.
[0022] Through the above technical solution, the embodiment of the present invention provides a method and device for generating a guard node set based on the K-Medoids algorithm in anonymous communication. By using the K-Medoids clustering algorithm and introducing the standard deviation as the evaluation standard for the quality of node set generation, the similarity of the node bandwidth in the generated node set can be effectively guaranteed, ensuring that the node sets joining the Tor network can meet the use requirements of the system.
[0023] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:
[0025] Figure 1 It is a flowchart of a method for generating a guard node set based on a K-Medoids algorithm in anonymous communication provided by an embodiment of the present invention;
[0026] Figure 2It is a structural block diagram of a guard node set generation device based on the K-Medoids algorithm in anonymous communication provided by another embodiment of the present invention.
[0027] Description of Reference Numerals
[0028] 1 Bandwidth data set generation unit 2 Bandwidth unit determination unit
[0029] 3 parameter calculation unit 4 guard node set generation unit DETAILED DESCRIPTION
[0030] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.
[0031] Figure 1 FIG. 1 is a flowchart of a method for generating a guard node set based on a K-Medoids algorithm in anonymous communication provided by an embodiment of the present invention. Figure 1 As shown, the method includes:
[0032] Step S101, determining whether the total bandwidth and number of nodes of the standby guard nodes meet the generation conditions of the guard node set;
[0033] Among them, the number of nodes and total bandwidth of the backup guard nodes in the network are counted regularly, and the generation condition of the guard node set is ∑bw_b i ≥Threshold BW , and N min ≤N b ≤N unusual , where ∑bw_b i Indicates the total bandwidth of the backup guard node, Threshold BW Generates the bandwidth threshold for the guard node set, N b Indicates the number of backup guard nodes, N min N represents the minimum number of backup guard nodes required to generate a good quality guard node set. unusual Indicates the minimum number of standby guard nodes that meet the abnormality judgment standard. In the present invention, N min The preferred setting is 30, N unusual The preferred setting is 60.
[0034] Step S102, when the generation condition of the guard node set is met, the bandwidth values of all backup guard nodes are obtained to generate a bandwidth data set;
[0035] When the condition of step S101 is met, the bandwidth data set may be generated by arranging the bandwidths in descending order.
[0036] Step S103, calculating the bandwidth unit of each standby guard node according to the bandwidth data set;
[0037] Step S104, determining whether the bandwidth unit of each standby guard node is equal to the bandwidth value, and when the bandwidth unit is not equal to the bandwidth value, using the bandwidth unit to replace the bandwidth value in the bandwidth data set;
[0038] Among them, the bandwidth unit quanta of each node is calculated according to the data set i , if quanta i ≠bw i , the system deletes bw from the data set i And quanta i Insert the location.
[0039] Step S105, generating a threshold value according to the bandwidth of each standby node and the bandwidth of the guard node set, and calculating the number of clusters for each standby node;
[0040] The number of clusters of each standby node can be calculated by the following formula:
[0041]
[0042]
[0043] Among them, Threshold BW Generates a threshold for the bandwidth of the guard node set, bw_b i is the bandwidth of each standby node, N k is the number of clusters of each standby node.
[0044] Step S106, selecting an initial centroid;
[0045] The backup guard node data set may be deduplicated to generate an initial centroid set, and then an initial centroid is selected based on the initial centroid set.
[0046] The initial centroid can be selected by the following formula:
[0047]
[0048] Among them, i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N k -1, interval is the sampling interval.
[0049] The purpose of the initial centroid set is to prevent the system from selecting initial centroids of the same size, which may lead to calculation errors during the clustering process. Since the data samples after descending order have a good decreasing distribution characteristic, the initial centroids can be selected by equal-interval sampling to ensure that the size distribution of the initial centroids is consistent with the distribution characteristics of the sample set. In order to avoid the number of samples in the initial centroid set being less than the number of clusters, which may lead to the collapse of the algorithm, the system also needs to judge the number of clusters. If N k >h, the system sets N k =h, in order to ensure the normal operation of the algorithm. The calculation of the sampling interval can be expressed as
[0050] Step S107, performing a clustering operation based on the K-Medoids algorithm according to the number of clusters and the initial centroid;
[0051] Among them, the K-Medoids Clustering Algorithm is a clustering analysis algorithm that is solved by iteration, where K represents the number of clusters. Those skilled in the art can know how to use the K-Medoids algorithm, which will not be described in detail here.
[0052] Step S108: generating a guard node set according to the total bandwidth of each clustering result.
[0053] The clustering result having a total bandwidth greater than a guard node set bandwidth generation threshold is selected to generate a guard node set.
[0054] Figure 2 FIG. 1 is a structural block diagram of a guard node set generation device based on a K-Medoids algorithm in anonymous communication provided by another embodiment of the present invention. Figure 2As shown, the device includes: a bandwidth data set generation unit 1, a bandwidth unit determination unit 2, a parameter calculation unit 3 and a guard node set generation unit 4, wherein the bandwidth data set generation unit 1 is used to: determine whether the total bandwidth and the number of nodes of the backup guard node meet the generation condition of the guard node set; when the generation condition of the guard node set is met, obtain the bandwidth values of all the backup guard nodes to generate a bandwidth data set; the bandwidth unit determination unit 2 is used to: calculate the bandwidth unit of each backup guard node according to the bandwidth data set; determine whether the bandwidth unit of each backup guard node is equal to the bandwidth value, and when the bandwidth unit is not equal to the bandwidth value, use the bandwidth unit to replace the bandwidth value in the bandwidth data set; the parameter calculation unit 3 is used to: calculate the number of clusters about each backup node according to the bandwidth of each backup node and the bandwidth generation threshold of the guard node set; select the initial centroid; the guard node set generation unit 4 is used to: perform clustering operation based on the K-Medoids algorithm according to the number of clusters and the initial centroid; generate a guard node set according to the total bandwidth of each clustering result.
[0055] Preferably, the parameter calculation unit 3 is used to calculate the number of clusters of each standby node by the following formula:
[0056]
[0057]
[0058] Among them, Threshold BW Generates a threshold for the bandwidth of the guard node set, bw_b i is the bandwidth of each standby node, N k is the number of clusters of each standby node.
[0059] Preferably, the parameter calculation unit 3 is used to: perform a deduplication operation on the backup guard node data set to generate an initial centroid set; and select an initial centroid according to the initial centroid set.
[0060] Preferably, the parameter calculation unit 3 is used to select the initial centroid by the following formula:
[0061]
[0062] Among them, i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N k -1, interval is the sampling interval.
[0063] The above-mentioned apparatus for generating a guard node set based on the K-Medoids algorithm in anonymous communication is similar to the above-mentioned embodiment of the method for generating a guard node set based on the K-Medoids algorithm in anonymous communication, and will not be described in detail here.
[0064] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0065] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0066] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0067] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0068] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0069] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0070] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0071] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0072] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A guard node set generation method based on K-Medoids algorithm in anonymous communication. It is characterized in that The method comprises: Determine whether the total bandwidth and number of standby guard nodes meet the generation conditions of the guard node set; When the generation condition of the guard node set is met, the bandwidth values of all backup guard nodes are obtained to generate a bandwidth data set; Calculate the bandwidth unit of each backup guard node according to the bandwidth data set; Determine whether the bandwidth unit of each standby guard node is equal to the bandwidth value, and when the bandwidth unit is not equal to the bandwidth value, use the bandwidth unit to replace the bandwidth value in the bandwidth data set; According to the bandwidth of each standby node and the bandwidth generation threshold of the guard node set, the number of clusters for each standby node is calculated; Select the initial centroid; Performing a clustering operation based on the K-Medoids algorithm according to the number of clusters and the initial centroid; A guard node set is generated based on the total bandwidth of each clustering result.
2. According to claim 1, the method for generating a guard node set based on the K-Medoids algorithm in anonymous communication, It is characterized in that The generating threshold value according to the bandwidth of each standby node and the bandwidth of the guard node set and calculating the number of clusters of each standby node includes: The number of clusters for each standby node is calculated using the following formula: Among them, Threshold BW Generates a threshold for the bandwidth of the guard node set, bw_b i is the bandwidth of each standby node, N k is the number of clusters of each standby node.
3. The method for generating a guard node set based on the K-Medoids algorithm in anonymous communication according to claim 1, It is characterized in that The selecting of the initial centroid includes: De-duplicate the backup guard node data set to generate an initial centroid set; An initial centroid is selected according to the initial centroid set.
4. The method for generating a guard node set based on the K-Medoids algorithm in anonymous communication according to claim 3, It is characterized in that The selecting the initial centroid according to the initial centroid set comprises: The initial centroid is selected by the following formula: Among them, i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N k -1, interval is the sampling interval.
5. A guard node set generation device based on K-Medoids algorithm in anonymous communication, It is characterized in that The device comprises: A bandwidth data set generating unit, a bandwidth unit determining unit, a parameter calculating unit and a guard node set generating unit, wherein: The bandwidth data set generating unit is used for: Determine whether the total bandwidth and number of standby guard nodes meet the generation conditions of the guard node set; When the generation condition of the guard node set is met, the bandwidth values of all backup guard nodes are obtained to generate a bandwidth data set; The bandwidth unit determining unit is used for: Calculate the bandwidth unit of each backup guard node according to the bandwidth data set; Determine whether the bandwidth unit of each standby guard node is equal to the bandwidth value, and when the bandwidth unit is not equal to the bandwidth value, use the bandwidth unit to replace the bandwidth value in the bandwidth data set; The parameter calculation unit is used for: According to the bandwidth of each standby node and the bandwidth generation threshold of the guard node set, the number of clusters for each standby node is calculated; Select the initial centroid; The guard node set generating unit is used for: Performing a clustering operation based on the K-Medoids algorithm according to the number of clusters and the initial centroid; A guard node set is generated based on the total bandwidth of each clustering result.
6. The device for generating a guard node set based on the K-Medoids algorithm in anonymous communication according to claim 5, It is characterized in that The parameter calculation unit is used for: The number of clusters for each standby node is calculated using the following formula: Among them, Threshold BW Generates a threshold for the bandwidth of the guard node set, bw_b i is the bandwidth of each standby node, N k is the number of clusters of each standby node.
7. The device for generating a guard node set based on the K-Medoids algorithm in anonymous communication according to claim 5, It is characterized in that The parameter calculation unit is used for: De-duplicate the backup guard node data set to generate an initial centroid set; An initial centroid is selected according to the initial centroid set.
8. The device for generating a guard node set based on the K-Medoids algorithm in anonymous communication according to claim 7, It is characterized in that The parameter calculation unit is used for: The initial centroid is selected by the following formula: Among them, i is the position of the initial centroid, h is the number of elements in the initial centroid set, and k is 0, 1, 2, 3...N k -1, interval is the sampling interval.
Citation Information
Patent Citations
Grouping rerouting method for anonymous communication system
CN102238090A
Beamforming and localizing in a configurable monitoring device system
CN102648472A
Anonymous protection method for user nodes of annular guard network and electronic equipment
CN112019502A
