Node clustering method and device, electronic equipment and storage medium
By obtaining the number of clusters and the number of nodes in the cluster based on the network throughput and transmission rate, combining preset cluster rules and the distance of the center point in the cluster, the first node of the cluster is determined, and the data transmission delay problem caused by uneven distribution of the first nodes in the cluster is solved, and efficient service data transmission is achieved.
Patent Information
- Application Number
- CN202411940784.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-03-28
AI Technical Summary
In the prior art, the node clustering method results in uneven distribution of the first nodes of the cluster, resulting in a higher delay in service data transmission and reducing transmission efficiency.
By obtaining the number of clusters based on the network throughput and transmission rate, and obtaining the number of nodes in the cluster with the total number of nodes, using preset clustering rules to obtain the clustering results, and using the node closest to the center point in the cluster as the first node of the cluster to achieve efficient data aggregation and transmission.
It realizes uniform distribution of the first nodes of the cluster, reduces the delay in service data transmission, and improves transmission efficiency and timeliness.
Smart Images

Figure CN119728522A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology, and in particular to a node clustering method, device, electronic device and storage medium. Background Art
[0002] In addition to real-time transaction services, financial institutions also have periodic batch processing services, which usually require network segmentation through node clustering and data aggregation through cluster head nodes.
[0003] In the prior art, traditional clustering is usually accomplished by random assignment, for example, by the LEACH (Low Energy Adaptive Clustering Hierarchy) clustering algorithm, which randomly assigns a number between 0 and 1 to each node in the service network and compares it with a specified threshold. If the random number of the node is greater than the specified threshold, the node is a normal node; if the random number of the node is less than the specified threshold, the node is a cluster head node.
[0004] However, such clustering method often leads to uneven distribution of nodes within the cluster, so that cluster head nodes are often concentrated in a certain area, which in turn causes a large transmission delay of business data and greatly reduces the transmission efficiency of business data. Summary of the invention
[0005] The present invention provides a node clustering method, device, electronic device and storage medium to solve the problem of high data transmission delay caused by uneven distribution of cluster head nodes.
[0006] According to one aspect of the present invention, a node clustering method is provided, comprising:
[0007] Obtaining the number of clusters according to the network throughput and the network transmission rate, and obtaining the number of nodes in the cluster according to the total number of nodes and the number of clusters;
[0008] Obtaining clustering results based on the number of clusters and the number of nodes in the clusters by using a preset clustering rule;
[0009] The first node in each cluster that is closest to the center point in the cluster is used as the cluster head node of each cluster, so that the cluster-aggregated data is sent to the destination node through the cluster head node.
[0010] After obtaining the number of nodes in the cluster according to the total number of nodes and the number of clusters, it also includes: if it is determined that the number of nodes in the cluster is greater than the number of clusters, obtaining the number of sub-clusters according to the number of nodes in the cluster and the number of clusters; obtaining the number of sub-cluster nodes according to the number of nodes in the cluster and the number of sub-clusters; obtaining clustering results based on the number of clusters and the number of nodes in the cluster by preset clustering rules, including: obtaining clustering results based on the number of clusters, the number of nodes in the cluster, the number of sub-clusters and the number of sub-cluster nodes by preset clustering rules; wherein the clustering results include cluster grouping and sub-cluster grouping.
[0011] After obtaining the clustering results based on the number of clusters and the number of nodes in the clusters by using the preset clustering rules, it also includes: obtaining the average distance between each node in each cluster and the nodes in other clusters, and taking the second node with the smallest average distance in each cluster as the cluster head node of each cluster.
[0012] The method of using the second node with the smallest average distance in each cluster as the cluster head node of each cluster includes: obtaining the maximum distance between the second node with the smallest average distance in the current cluster and nodes in other clusters, and comparing the maximum distance with a preset distance threshold; if it is determined that the maximum distance is less than or equal to the preset distance threshold, using the second node as the cluster head node of the current cluster; if it is determined that the maximum distance is greater than the preset distance threshold, successively obtaining other nodes with the smallest average distance in the current cluster, and comparing the maximum distances corresponding to the other nodes with the preset distance threshold, until the maximum distance corresponding to the current node is less than or equal to the preset distance threshold, using the current node as the cluster head node of the current cluster.
[0013] After sequentially acquiring other nodes with the smallest average distance in the current cluster and comparing the maximum distances corresponding to the other nodes with the preset distance threshold, the method further includes: if the maximum distances corresponding to the various nodes in the current cluster are greater than the preset distance threshold, acquiring the maximum distance weight and the average distance weight according to the number of nodes in the cluster; wherein the average distance weight is positively correlated with the number of nodes in the cluster, and the maximum distance weight is negatively correlated with the number of nodes in the cluster; acquiring the distance score of each node according to the maximum distance and the average distance corresponding to each node, as well as the maximum distance weight and the average distance weight, and taking the node with the smallest distance score as the cluster head node of the current cluster.
[0014] The method obtains clustering results based on the number of clusters and the number of nodes in the cluster by using a preset clustering rule, including: obtaining a first distance between each node, and assigning two nodes corresponding to the largest one of the first distances to the first cluster and the second cluster respectively; if it is determined that there is a blank cluster, obtaining a second distance between an unassigned node and each assigned node according to the number of clusters, and taking the largest one of the second distances as a clustering distance basis; assigning the unassigned nodes corresponding to the clustering distance basis to the blank cluster according to the number of clusters, and continuing to assign other unassigned nodes to the blank cluster according to the number of clusters until there is no blank cluster; and assigning the unassigned nodes to each cluster in turn according to the number of nodes in the cluster and the third distance between the unassigned node and the center point in each cluster.
[0015] According to another aspect of the present invention, a node clustering device is provided, comprising:
[0016] The node acquisition module in the cluster is used to acquire the number of clusters according to the network throughput and the network transmission rate, and acquire the number of nodes in the cluster according to the total number of nodes and the number of clusters;
[0017] A clustering result acquisition module, used to acquire clustering results based on the number of clusters and the number of nodes in the clusters by using a preset clustering rule;
[0018] The cluster head node acquisition module is used to use the first node in each cluster that is closest to the center point in the cluster as the cluster head node of each cluster, so as to send the cluster aggregated data to the destination node through the cluster head node.
[0019] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0020] at least one processor; and
[0021] a memory communicatively connected to the at least one processor; wherein,
[0022] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the node clustering method described in any embodiment of the present invention.
[0023] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the node clustering method described in any embodiment of the present invention when executed.
[0024] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the node clustering method according to any embodiment of the present invention is implemented.
[0025] The technical solution of the embodiment of the present invention obtains the number of clusters according to the network throughput and the network transmission rate, and obtains the number of nodes in the cluster according to the total number of nodes and the number of clusters; obtains the clustering results based on the number of clusters and the number of nodes in the cluster by presetting clustering rules; and uses the first node in each cluster that is closest to the center point in the cluster as the cluster head node of each cluster, so as to send the clustered data to the destination node through the cluster head node. In this way, not only the automatic acquisition of the node clustering results in the business network is realized, but also the uniform distribution of the cluster head nodes is ensured, the delay problem existing in the business data transmission process is solved, the transmission efficiency of the business data is greatly improved, and the timeliness of the business data transmission is improved.
[0026] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0028] Figure 1 is a flowchart of a node clustering method provided according to Embodiment 1 of the present invention;
[0029] Figure 2 is a flowchart of another node clustering method provided according to the second embodiment of the present invention;
[0030] Figure 3 is a flowchart of another node clustering method provided according to Embodiment 3 of the present invention;
[0031] Figure 4 is a schematic diagram of the structure of a node clustering device provided according to a fourth embodiment of the present invention;
[0032] Figure 5 It is a structural schematic diagram of an electronic device for implementing the node clustering method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0035] Embodiment 1
[0036] Figure 1 This is a flowchart of a node clustering method provided in Embodiment 1 of the present invention. This embodiment can be applied to obtaining a cluster head node according to the distance between each node and the center point in the cluster. The method can be executed by a node clustering device in any embodiment of the present invention. The node clustering device can be implemented in the form of hardware and / or software. The node clustering device can be configured in an electronic device. The electronic device can be any service node in the service network or other devices outside the service network, such as Figure 1 As shown, the method includes:
[0037] S101. Acquire the number of clusters according to network throughput and network transmission rate, and acquire the number of nodes in the cluster according to the total number of nodes and the number of clusters.
[0038] The business network in the embodiment of the present invention may refer to the business system of a financial institution, which is composed of multiple business nodes. Each business node has periodic business processing requirements while processing real-time services (for example, transaction tasks). Network throughput refers to the maximum rate that the business network can accept without frame loss, that is, the amount of data successfully transmitted per unit time; network transmission rate refers to the data transmission speed in the business network; the ratio of network throughput to network transmission rate indicates the number of nodes in the business network that can simultaneously perform data transmission.
[0039] Since each cluster sends out periodic business data through the cluster head node of the cluster, the above ratio can be used as the number of cluster head nodes. Since each cluster has only one cluster head node, the ratio actually also represents the number of clusters (i.e., the number of clusters); the ratio of the total number of nodes to the number of clusters is used as the number of nodes in each cluster (i.e., the number of nodes in the cluster) to keep the number of nodes in each cluster balanced. In particular, if the ratio of network throughput to network transmission rate is not an integer value, then the number of clusters is equal to the integer part of the ratio, so as to avoid data congestion in the business network when there are too many clusters and a large number of cluster head nodes send out transmission data at the same time.
[0040] S102: Obtain a clustering result based on the number of clusters and the number of nodes in the clusters by using a preset clustering rule.
[0041] The preset clustering rules may include one or more clustering algorithms, for example, K-means clustering algorithm, K-medoids clustering algorithm, density-based clustering algorithm (DBSCAN) and maximum expectation clustering algorithm based on Gaussian mixture model (GMM), etc. The number of clusters and the number of nodes in the cluster obtained by the above calculation are used as clustering targets, thereby obtaining the clustering results of the business network through any of the above clustering algorithms to ensure that all business nodes are evenly distributed to each cluster and the distance between each business node in each cluster is close.
[0042] In addition, clustering results can also be obtained through the above-mentioned multiple clustering algorithms, and the clustering method that appears most frequently in each clustering result is used as the final clustering result. In particular, if the ratio of the total number of nodes to the number of clusters is not an integer value, the two integer values adjacent to the ratio are used as the number of nodes in the cluster, that is, the number of nodes in the cluster is A or B; where A is the value closest to the ratio among all values less than the ratio; and B is the value closest to the ratio among all values greater than the ratio.
[0043] S103 , using the first node in each cluster that is closest to the center point in the cluster as the cluster head node of each cluster, so as to send the aggregated data in the cluster to the destination node through the cluster head node.
[0044] While completing node clustering based on the clustering algorithm, the position of the center point in each cluster can be obtained at the same time, that is, the position of the center point in the cluster; wherein, the center point position may happen to be a certain business node, or it may be other physical points in the business network except the business nodes; if the center point position is a certain business node, the business node can be directly used as the cluster head node; if the center point position is a blank point in the business network, then a node (that is, the first node) with the closest physical distance to the point is obtained as the cluster head node of the cluster, thereby realizing the calculation and acquisition of the cluster head node.
[0045] The cluster head node is used to aggregate the periodic business data reported by each node in the cluster, and after the above business data is aggregated, it is sent to the destination node, so as to realize clustered transmission of business data and avoid data congestion in the business network due to too many data transmission nodes; wherein, the destination node can be a node in the current business network or other device nodes outside the current business network.
[0046] In particular, if the calculation and acquisition of the above-mentioned cluster head node is completed only by the current electronic device, and the current electronic device itself is a business node in the business network, or an independent electronic device outside the business network, then the current electronic device will send the calculated clustering results and cluster head node information to each cluster head node in the business network, so that each cluster head node knows that it is the cluster head node and which other nodes are included in the cluster, and then forwards the clustering results to other nodes in the cluster through the cluster head node, so as to realize the layer-by-layer distribution of clustering results and cluster head node information, thereby avoiding data congestion during the clustering process.
[0047] In addition, if each business node in the business network calculates and obtains the clustering results and cluster head node information through the above-mentioned technical solution, then the business node only needs to record the cluster to which it is located, as well as the cluster head node and non-cluster head nodes in its cluster, and there is no need to send the clustering results and cluster head node information to each business node; at this time, if the current node is the cluster head node, the current node is used to aggregate the business data sent by the non-cluster head nodes in the cluster; if the current node is a non-cluster head node, the current node is used to send the business data to the cluster head node in the cluster.
[0048] Optionally, in an embodiment of the present invention, after obtaining the number of nodes in the cluster according to the total number of nodes and the number of clusters, it also includes: if it is determined that the number of nodes in the cluster is greater than the number of clusters, obtaining the number of sub-clusters according to the number of nodes in the cluster and the number of clusters; obtaining the number of sub-cluster nodes according to the number of nodes in the cluster and the number of sub-clusters; obtaining clustering results based on the number of clusters and the number of nodes in the cluster through preset clustering rules includes: obtaining clustering results based on the number of clusters, the number of nodes in the cluster, the number of sub-clusters and the number of sub-cluster nodes through preset clustering rules; wherein the clustering results include cluster grouping and sub-cluster grouping.
[0049] Specifically, if the number of nodes in a cluster is greater than the number of clusters, then when each node in a cluster simultaneously sends periodic business information to the cluster head node of the cluster, data congestion may also occur due to the data transmission volume exceeding the network throughput; therefore, when the number of nodes in a cluster is greater than the number of clusters, it is necessary to continue to perform clustering operations on each node in the cluster, that is, to divide the cluster into multiple sub-clusters so that the number of nodes in each sub-cluster is less than or equal to the number of clusters; if the number of nodes in a sub-cluster is still greater than the number of clusters, it is necessary to continue to perform clustering nesting within the sub-cluster until the number of sub-cluster nodes in the lowest-level sub-cluster is less than or equal to the number of clusters.
[0050] The nodes in each sub-cluster send the service data to the sub-cluster head node, and each sub-cluster head node sends the summary data to the head node of the upper level (i.e., the sub-cluster head node or cluster head node of the upper level), until each cluster head node sends the summary data to the destination node. Thus, by nesting one or more sub-clusters in each cluster, the layer-by-layer reporting of periodic service data is realized, ensuring the timeliness of data transmission, and avoiding data congestion caused by too many nodes transmitting data at the same time.
[0051] Optionally, in an embodiment of the present invention, the first node in each cluster that is closest to the center point of the cluster is used as the cluster head node of each cluster, specifically including: judging whether the average processing volume of real-time business data processed by the first node in the current cluster that is closest to the center point of the cluster is less than a preset quantity threshold; if it is determined to be less than the preset quantity threshold, using the first node as the cluster head node of the current cluster; if it is determined to be greater than or equal to the preset quantity threshold, continuing to judge whether the average processing volume of real-time business data processed by other nodes in the current cluster that are closest to the center point of the cluster is less than the preset quantity threshold, until the average processing volume of real-time business data processed by the current node is less than the preset quantity threshold, using the current node as the cluster head node of the current cluster.
[0052] Specifically, as described in the above technical solution, the selection of the cluster head node is usually to facilitate the reporting of periodic business data at all levels. For each node, in addition to processing periodic business data, it also needs to carry a large amount of real-time business data (for example, transaction business data in the above technical solution). Therefore, for the selection of the cluster head node, in addition to shortening the distance between the cluster head node and other nodes in the cluster, it is also necessary to reduce the data processing volume of the cluster head node itself to reduce the data processing pressure of the cluster head node.
[0053] If the average processing volume of real-time business data processed by the first node closest to the center point of the cluster in the current cluster is less than the preset quantity threshold, it means that the data processing pressure of the first node itself is relatively small, and the first node can be directly used as the cluster head node; if the average processing volume of real-time business data processed by the first node closest to the center point of the cluster in the current cluster is greater than or equal to the preset quantity threshold, it means that the data processing pressure of the first node itself is relatively large, and it is necessary to continue to obtain the average processing volume of other nodes in the current cluster that are closest to the center point of the cluster. Until the average processing volume of real-time business data processed by the current node is less than the preset quantity threshold, the current node is used as the cluster head node of the current cluster.
[0054] The average processing capacity of each node can be obtained through historical business records, which reflects the total amount of data that each node needs to process per unit time. The larger the average processing capacity, the greater the data processing pressure of the node; the smaller the average processing capacity, the smaller the data processing pressure of the node; the cluster head node selected based on this not only makes the distance between it and other nodes in the cluster closer, but also avoids excessive data processing pressure on the cluster head node, resulting in transmission delay problems for the current periodic business data to be transmitted, ensuring a higher data transmission efficiency of the cluster head node and improving the timeliness of business data transmission.
[0055] In particular, although real-time services do not have a fixed trigger cycle, each service often has certain business rules and has the characteristics of concentration in specific time periods. For example, from 9:00 to 9:10 every day, transaction business data increases significantly. If periodic business data is also reported during this period, then the average processing volume of real-time business data during this period will obviously affect the transmission timeliness of periodic business data. Therefore, the above average processing volume can specifically refer to the average processing volume of each node at each reporting moment of periodic business data, rather than the average processing volume of the node during the entire time period, so that the cluster head node has less data processing pressure at the reporting moment of periodic business data, thereby further improving the transmission timeliness of the cluster head node business data.
[0056] The technical solution of the embodiment of the present invention obtains the number of clusters according to the network throughput and the network transmission rate, and obtains the number of nodes in the cluster according to the total number of nodes and the number of clusters; obtains the clustering results based on the number of clusters and the number of nodes in the cluster by presetting clustering rules; and uses the first node in each cluster that is closest to the center point in the cluster as the cluster head node of each cluster, so as to send the clustered data to the destination node through the cluster head node. In this way, not only the automatic acquisition of the node clustering results in the business network is realized, but also the uniform distribution of the cluster head nodes is ensured, the delay problem existing in the business data transmission process is solved, the transmission efficiency of the business data is greatly improved, and the timeliness of the business data transmission is improved.
[0057] Embodiment 2
[0058] Figure 2 This is a flowchart of a node clustering method provided by Embodiment 2 of the present invention. The relationship between this embodiment and the above embodiments is that the cluster head node is selected based on the average distance between each node in each cluster and the nodes in other clusters. Figure 2 As shown, the method includes:
[0059] S201. Acquire the number of clusters according to the network throughput and the network transmission rate, and acquire the number of nodes in the cluster according to the total number of nodes and the number of clusters.
[0060] S202: Obtain a clustering result based on the number of clusters and the number of nodes in the clusters by using a preset clustering rule.
[0061] S203, obtaining the average distance between each node in each cluster and nodes in other clusters, and using the second node with the smallest average distance in each cluster as the cluster head node of each cluster, so as to send the cluster aggregated data to the destination node through the cluster head node.
[0062] It is also possible to obtain the physical distance between each node in a cluster and other nodes in the current cluster (i.e., nodes within the cluster), and then use the average of the physical distances corresponding to the node as the average distance corresponding to the node; obtain the smallest average distance corresponding to all nodes in a cluster, and use the node corresponding to the smallest average distance (i.e., the second node) as the cluster head node of the current cluster; thereby avoiding the clustering acquisition of the center point within the cluster, reducing the calculation complexity of the cluster head node, and improving the efficiency of obtaining the cluster head node.
[0063] Optionally, in an embodiment of the present invention, the method of using the second node with the smallest average distance in each cluster as the cluster head node of each cluster includes: obtaining the maximum distance between the second node with the smallest average distance in the current cluster and nodes in other clusters, and comparing the maximum distance with a preset distance threshold; if it is determined that the maximum distance is less than or equal to the preset distance threshold, using the second node as the cluster head node of the current cluster; if it is determined that the maximum distance is greater than the preset distance threshold, obtaining other nodes with the smallest average distance in the current cluster in turn, and comparing the maximum distances corresponding to the other nodes with the preset distance threshold, until the maximum distance corresponding to the current node is less than or equal to the preset distance threshold, using the current node as the cluster head node of the current cluster.
[0064] Specifically, a smaller average distance means that the cluster head node needs to occupy less data transmission resources when obtaining the transmission data of other nodes, but for each cluster head node, it actually needs to wait for all the nodes in the cluster to complete the reporting before it can send the aggregated data to the destination node; if the distance between the cluster head node and one of the nodes in the cluster (maximum distance) is too far, although the average distance is shorter, due to the existence of the maximum distance, the cluster head node actually needs to wait for a longer data transmission time, affecting the timeliness of data reporting.
[0065] Therefore, it is necessary to obtain the maximum distance between the second node with the smallest average distance in the current cluster and other cluster nodes in the cluster, and compare the maximum distance with the preset distance threshold; if it is determined that the above maximum distance is less than or equal to the preset distance threshold, directly use the second node as the cluster head node of the current cluster; if it is determined that the maximum distance is greater than the preset distance threshold, continue to obtain the one with the smallest average distance among the remaining nodes in the current cluster (i.e., the remaining cluster nodes), and continue to compare its corresponding maximum distance with the preset distance threshold.
[0066] If it is determined that its maximum distance is less than or equal to the preset distance threshold, it is directly used as the cluster head node of the current cluster; if its maximum distance is still greater than the preset distance threshold, continue to obtain the node with the smallest average distance among the remaining nodes in the cluster, until a node corresponding to the maximum distance is less than or equal to the preset distance threshold, and then the node is used as the cluster head node; thereby, under the premise of occupying less data transmission resources, the phenomenon of data aggregation taking too long is avoided, and the timeliness of transmission of periodic business data is further improved.
[0067] Optionally, in an embodiment of the present invention, after successively obtaining other nodes with the smallest average distance in the current cluster and comparing the maximum distance corresponding to the other nodes with a preset distance threshold, it also includes: if the maximum distances corresponding to each node in the current cluster are greater than the preset distance threshold, obtaining a maximum distance weight and an average distance weight according to the number of nodes in the cluster; wherein the average distance weight is positively correlated with the number of nodes in the cluster, and the maximum distance weight is negatively correlated with the number of nodes in the cluster; according to the maximum distance and average distance corresponding to each node, respectively, as well as the maximum distance weight and the average distance weight, obtaining the distance score of each node, and taking the node with the smallest distance score as the cluster head node of the current cluster.
[0068] Specifically, if the maximum distance corresponding to each node in a cluster is greater than the preset distance threshold, different weight values need to be configured for the maximum distance and the average distance respectively, and then the product of the maximum distance and the maximum distance weight, and the product of the average distance and the average distance weight are obtained, and then the sum of the above two product results is obtained, and finally the node corresponding to the minimum sum result is used as the cluster head node; among which, the sum of the maximum distance weight and the average distance weight is a fixed value (for example, 1).
[0069] The more nodes there are in the cluster, the greater the value provided by the average distance, that is, the cluster head node needs to be as close to each node as possible to save the amount of resources occupied by data transmission. At this time, the weight value assigned to the average distance is larger; correspondingly, the smaller the value provided by the maximum distance, that is, the cluster head node cannot significantly increase the transmission resource consumption between it and other nodes for the transmission time of a single node.
[0070] Similarly, the fewer the number of nodes in the cluster, the greater the value provided by the maximum distance, that is, the cluster head node needs to reduce the maximum transmission distance as much as possible to reduce the time consumption of data aggregation and improve the timeliness of data transmission; correspondingly, the less the value provided by the average distance, that is, the cluster head node cannot significantly increase the data aggregation time consumption in order to reduce the transmission resource consumption between a few nodes. Based on this, the cluster head node is obtained according to the distance score of each node, which ensures both a lower transmission resource occupancy and a shorter data aggregation time.
[0071] The technical solution of the embodiment of the present invention obtains the average distance between each node in each cluster and the nodes in other clusters after obtaining the clustering results based on the number of clusters and the number of nodes in the cluster through preset clustering rules, and uses the second node with the smallest average distance in each cluster as the cluster head node of each cluster, thereby avoiding the clustering acquisition of the center point in the cluster, reducing the calculation complexity of the cluster head node, and improving the efficiency of obtaining the cluster head node.
[0072] Embodiment 3
[0073] Figure 3 This is a flowchart of a node clustering method provided by Embodiment 3 of the present invention. The relationship between this embodiment and the above embodiments is that all nodes are clustered in sequence according to the distance between each node. Figure 3 As shown, the method includes:
[0074] S301. Acquire the number of clusters according to network throughput and network transmission rate, and acquire the number of nodes in the cluster according to the total number of nodes and the number of clusters.
[0075] S302 , obtaining the first distance between each node, and assigning two nodes corresponding to the largest value of each first distance to the first cluster and the second cluster respectively.
[0076] Get the first distance between each node, that is, get the distance between each node and other nodes. Among the above first distances, select the two nodes with the farthest distance, that is, node A and node B, and assign node A to one cluster (that is, the first cluster) and assign node B to another cluster (that is, the second cluster).
[0077] S303: If it is determined that there is a blank cluster, obtain the second distances between the unallocated nodes and each allocated node according to the number of clusters, and use the second distance with the largest value as a clustering distance basis.
[0078] A blank cluster refers to a cluster that does not contain any nodes. Based on the number of clusters, if it is determined that there are still blank clusters, continue to obtain the second distances between the unallocated nodes (i.e., the remaining nodes except node A and node B) and each allocated node (i.e., node A and node B). Obviously, each unallocated node corresponds to two second distances. Obtain the one with the largest value among the above second distances.
[0079] S304: Allocate the clustering distances into blank clusters according to the corresponding unallocated nodes according to the number of clusters, and continue to allocate other unallocated nodes into blank clusters according to the number of clusters until there are no blank clusters.
[0080] Assume that the node corresponding to the largest value among the above-mentioned second distances is node C, and node C is assigned to a blank cluster at this time; the total number of blank clusters at the initial moment is obviously the number of clusters mentioned above, and the number of blank clusters decreases as nodes are continuously assigned; if there are still blank clusters at this time, the node assignment is completed according to the largest value of the second distance between the unassigned node and each assigned node, so that there is only one node in each cluster; if there is no blank cluster, that is, at this time the number of non-blank clusters is equal to the number of clusters mentioned above.
[0081] S305 . Allocate the unallocated nodes to each cluster in sequence according to the number of nodes in the cluster and the third distance between the unallocated nodes and the center point in each cluster.
[0082] The center point in a cluster will change as the number of nodes in the cluster changes. After a cluster is assigned to a node, the center point of the cluster will be updated. For example, when a cluster includes only one node, the center point in the cluster is the location of the node. When a cluster includes two nodes, the center point in the cluster is the center point of the line connecting the two nodes. Since each cluster includes at least one cluster, the third distance between each unassigned node and the center point in each cluster is obtained in turn, and the cluster corresponding to the smallest value among the third distances is used as the cluster where the current unassigned node is located.
[0083] At the same time, when the number of nodes in a cluster reaches the number of nodes in the cluster, no node will be assigned to the cluster, that is, the third distance between the unassigned node and the center point of the cluster will no longer be obtained. Only the third distance between the unassigned node and the unsaturated cluster (that is, the cluster whose number of nodes does not reach the number of nodes in the cluster) will be obtained until all nodes are assigned to the corresponding clusters.
[0084] S306: The first node in each cluster that is closest to the center point of the cluster is used as the cluster head node of each cluster, so as to send the aggregated data in the cluster to the destination node through the cluster head node.
[0085] The technical solution of the embodiment of the present invention is to allocate the two nodes corresponding to the largest value in each first distance to the first cluster and the second cluster respectively, and then allocate the unallocated nodes to the blank cluster according to the number of clusters until there is no blank cluster; finally, according to the number of nodes in the cluster and the third distance between the unallocated nodes and the center point in each cluster, the unallocated nodes are allocated to each cluster in turn. In this way, the clustering operation based on the physical distance between nodes is realized, the clustering of each node is ensured to be close, the delay problem existing in the service data transmission process is solved, the transmission efficiency of service data is greatly improved, and the timeliness of service data transmission is improved.
[0086] Embodiment 4
[0087] Figure 4 : is a structural block diagram of a node clustering device provided by Embodiment 4 of the present invention, and the device specifically includes:
[0088] The intra-cluster node acquisition module 401 is used to acquire the number of clusters according to the network throughput and the network transmission rate, and acquire the number of intra-cluster nodes according to the total number of nodes and the number of clusters;
[0089] A clustering result acquisition module 402 is used to acquire clustering results based on the number of clusters and the number of nodes in the clusters according to a preset clustering rule;
[0090] The cluster head node acquisition module 403 is used to use the first node in each cluster that is closest to the center point in the cluster as the cluster head node of each cluster, so as to send the cluster aggregated data to the destination node through the cluster head node.
[0091] The technical solution of the embodiment of the present invention obtains the number of clusters according to the network throughput and the network transmission rate, and obtains the number of nodes in the cluster according to the total number of nodes and the number of clusters; obtains the clustering results based on the number of clusters and the number of nodes in the cluster by presetting clustering rules; and uses the first node in each cluster that is closest to the center point in the cluster as the cluster head node of each cluster, so as to send the clustered data to the destination node through the cluster head node. In this way, not only the automatic acquisition of the node clustering results in the business network is realized, but also the uniform distribution of the cluster head nodes is ensured, the delay problem existing in the business data transmission process is solved, the transmission efficiency of the business data is greatly improved, and the timeliness of the business data transmission is improved.
[0092] Optionally, the node clustering device is also used to, if it is determined that the number of nodes in the cluster is greater than the number of clusters, obtain the number of sub-clusters based on the number of nodes in the cluster and the number of clusters; obtain the number of sub-cluster nodes based on the number of nodes in the cluster and the number of sub-clusters; and obtain clustering results based on the number of clusters, the number of nodes in the cluster, the number of sub-clusters and the number of sub-cluster nodes through preset clustering rules; wherein the clustering results include cluster grouping and sub-cluster grouping.
[0093] Optionally, the node clustering device is further used to obtain the average distance between each node in each cluster and nodes in other clusters, and use the second node with the smallest average distance in each cluster as the cluster head node of each cluster.
[0094] Optionally, the node clustering device is also used to obtain the maximum distance between the second node with the smallest average distance in the current cluster and the nodes in other clusters, and compare the maximum distance with a preset distance threshold; if it is determined that the maximum distance is less than or equal to the preset distance threshold, the second node is used as the cluster head node of the current cluster; if it is determined that the maximum distance is greater than the preset distance threshold, other nodes with the smallest average distance in the current cluster are obtained in turn, and the maximum distances corresponding to the other nodes are compared with the preset distance threshold, until the maximum distance corresponding to the current node is less than or equal to the preset distance threshold, and the current node is used as the cluster head node of the current cluster.
[0095] Optionally, the node clustering device is also used to obtain a maximum distance weight and an average distance weight according to the number of nodes in the cluster if the maximum distances corresponding to the various nodes in the current cluster are greater than a preset distance threshold; wherein the average distance weight is positively correlated with the number of nodes in the cluster, and the maximum distance weight is negatively correlated with the number of nodes in the cluster; and according to the maximum distance and average distance corresponding to each node, respectively, as well as the maximum distance weight and the average distance weight, obtain the distance score of each node, and use the node with the smallest distance score as the cluster head node of the current cluster.
[0096] Optionally, the node clustering device is also used to obtain the first distance between each node, and allocate the two nodes corresponding to the largest one of the first distances to the first cluster and the second cluster respectively; if it is determined that there is a blank cluster, obtain the second distance between the unallocated node and each allocated node according to the number of clusters, and use the largest one of the second distances as the clustering distance basis; allocate the unallocated nodes corresponding to the clustering distance basis to the blank cluster according to the number of clusters, and continue to allocate other unallocated nodes to the blank cluster according to the number of clusters until there is no blank cluster; allocate the unallocated nodes to each cluster in turn according to the number of nodes in the cluster and the third distance between the unallocated node and the center point of each cluster.
[0097] The above device can execute the node clustering method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail in this embodiment, please refer to the node clustering method provided by any embodiment of the present invention.
[0098] Embodiment 5
[0099] Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, electronic devices, blade electronic devices, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0100] like Figure 5As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0101] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0102] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as the node clustering method.
[0103] In some embodiments, the node clustering method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed on a heterogeneous hardware accelerator via a ROM and / or a communication unit. When the computer program is loaded into RAM and executed by a processor, one or more steps of the node clustering method described above may be performed. Alternatively, in other embodiments, the processor may be configured to perform the node clustering method by any other appropriate means (e.g., by means of firmware).
[0104] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0105] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or electronic device.
[0106] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0107] To provide interaction with a user, the systems and techniques described herein may be implemented on a heterogeneous hardware accelerator having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) through which a user can provide input to the heterogeneous hardware accelerator. Other types of devices may also be used to provide interaction with a user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0108] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data electronic device), or a computing system that includes middleware components (e.g., an application electronic device), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0109] The computing system may include a client and an electronic device. The client and the electronic device are generally remote from each other and usually interact through a communication network. The relationship between the client and the electronic device is generated by computer programs running on corresponding computers and having a client-electronic device relationship with each other. The electronic device may be a cloud electronic device, also known as a cloud computing electronic device or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0110] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0111] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A node clustering method, characterized in that: include: Obtaining the number of clusters according to the network throughput and the network transmission rate, and obtaining the number of nodes in the cluster according to the total number of nodes and the number of clusters; Obtaining clustering results based on the number of clusters and the number of nodes in the clusters by using a preset clustering rule; The first node in each cluster that is closest to the center point in the cluster is used as the cluster head node of each cluster, so that the cluster-aggregated data is sent to the destination node through the cluster head node.
2. The method according to claim 1, characterized in that After obtaining the number of nodes in the cluster according to the total number of nodes and the number of clusters, the method further includes: If it is determined that the number of nodes in the cluster is greater than the number of clusters, obtaining the number of sub-clusters according to the number of nodes in the cluster and the number of clusters; Acquire the number of sub-cluster nodes according to the number of nodes in the cluster and the number of sub-clusters; The obtaining of clustering results based on the number of clusters and the number of nodes in the clusters by using a preset clustering rule includes: By presetting clustering rules, a clustering result is obtained based on the number of clusters, the number of nodes in the cluster, the number of sub-clusters and the number of sub-cluster nodes; wherein the clustering result includes cluster grouping and sub-cluster grouping.
3. The method according to claim 1, characterized in that After obtaining the clustering result based on the number of clusters and the number of nodes in the clusters by using the preset clustering rule, the method further includes: The average distance between each node in each cluster and the nodes in other clusters is obtained, and the second node with the smallest average distance in each cluster is used as the cluster head node of each cluster.
4. The method according to claim 3, characterized in that The method of using the second node with the smallest average distance in each cluster as the cluster head node of each cluster includes: Obtain the maximum distance between the second node with the smallest average distance in the current cluster and the nodes in other clusters, and compare the maximum distance with a preset distance threshold; If it is determined that the maximum distance is less than or equal to a preset distance threshold, taking the second node as the cluster head node of the current cluster; If it is determined that the maximum distance is greater than the preset distance threshold, other nodes with the smallest average distance in the current cluster are obtained in turn, and the maximum distances corresponding to the other nodes are compared with the preset distance threshold. When the maximum distance corresponding to the current node is less than or equal to the preset distance threshold, the current node is used as the cluster head node of the current cluster.
5. The method according to claim 4, characterized in that After sequentially acquiring other nodes with the smallest average distance in the current cluster and comparing the maximum distance corresponding to the other nodes with the preset distance threshold, the method further includes: If the maximum distances corresponding to the nodes in the current cluster are all greater than the preset distance threshold, the maximum distance weight and the average distance weight are obtained according to the number of nodes in the cluster; wherein the average distance weight is positively correlated with the number of nodes in the cluster, and the maximum distance weight is negatively correlated with the number of nodes in the cluster; According to the maximum distance and average distance corresponding to each node, as well as the maximum distance weight and the average distance weight, the distance score of each node is obtained, and the node with the smallest distance score is used as the cluster head node of the current cluster.
6. The method according to claim 1, characterized in that The obtaining of clustering results based on the number of clusters and the number of nodes in the clusters by using a preset clustering rule includes: Obtain the first distance between each node, and assign the two nodes corresponding to the largest value of each first distance to the first cluster and the second cluster respectively; If it is determined that there is a blank cluster, the second distances between the unallocated nodes and each allocated node are obtained according to the number of clusters, and the largest value of each second distance is used as the clustering distance basis; According to the number of clusters, the clustering distance is allocated to a blank cluster according to the corresponding unallocated nodes, and other unallocated nodes are continuously allocated to the blank cluster according to the number of clusters until there is no blank cluster; The unassigned nodes are sequentially assigned to each cluster according to the number of nodes in the cluster and the third distance between the unassigned nodes and the center point in each cluster.
7. A node clustering device, characterized in that: include: The node acquisition module in the cluster is used to acquire the number of clusters according to the network throughput and the network transmission rate, and acquire the number of nodes in the cluster according to the total number of nodes and the number of clusters; A clustering result acquisition module, used to acquire clustering results based on the number of clusters and the number of nodes in the clusters by using a preset clustering rule; The cluster head node acquisition module is used to use the first node in each cluster that is closest to the center point in the cluster as the cluster head node of each cluster, so as to send the cluster aggregated data to the destination node through the cluster head node.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the node clustering method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the node clustering method according to any one of claims 1 to 6 when executed.
10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the node clustering method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Clustering routing method based on wireless sensor network node middleware
CN103179628A
Flight path-based aviation ad hoc network clustering method and computer readable storage medium
CN110324788A
Low-energy-consumption efficient data collection method based on clustering routing
CN116506917A
Anti-dynamic network self-organization method based on time-space synchronization
CN117858191A
Dynamic clustering and MPR selection method in unmanned aerial vehicle ad hoc network
CN117979389A