Community discovery method based on Grover search algorithm and related device
The Grover search algorithm is used to search for modularity gains on quantum computers and merge network nodes, which solves the problem of low community discovery efficiency in large-scale networks and achieves efficient community structure identification.
Patent Information
- Application Number
- CN202410766135.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-06-14
AI Technical Summary
When faced with large-scale complex networks, it is difficult for classical computers to discover community structures efficiently and cannot fully utilize the high-speed parallel computing capabilities of quantum computers.
A community discovery method based on the Grover search algorithm is used to prepare the target quantum state, use the Grover search algorithm to search for some components whose modularity gain is greater than the preset threshold, merge adjacent nodes into community nodes, and update the network until all modularity gains are no longer greater than 0.
Effectively utilizing the high-speed parallel computing capabilities of quantum computers and the secondary acceleration effect of the Grover search algorithm, we achieve more efficient community discovery than classical algorithms, simplifying the network structure and improving modularity.
Smart Images

Figure CN118710430A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of quantum computing technology, and in particular to a community discovery method and related devices based on a Grover search algorithm. Background Art
[0002] In recent years, community structure discovery has become a hot topic in complex network research and has received widespread attention from researchers in the fields of computer science, mathematics, biology, and sociology. Community structure discovery in complex networks has important theoretical significance and practical value for network topology analysis, functional analysis, and behavior prediction. For example, in common social networks, users are equivalent to network nodes, and interactions between users in the form of following, liking, and private messaging form connections between nodes; among them, some nodes with more close connections can be regarded as a community, and the nodes within each community are more connected to each other, while the nodes between different communities are less connected. Therefore, based on the community division, value assessment, content recommendation, risk management and other services can be provided to users in each community in a more targeted manner.
[0003] As a method of identifying closely connected groups of nodes in a network, community discovery algorithms can be roughly divided into three categories: hierarchical segmentation methods based on network graph structures, clustering-based methods, and optimization-based methods. When faced with large-scale network structures, it is very difficult for classical computers to run these methods due to the large number of nodes and complex connection relationships in the network. Quantum computers are physical devices that follow the laws of quantum mechanics to perform high-speed mathematical and logical operations, store and process quantum information, and have the ability to process mathematical problems more efficiently than classical computers. Therefore, how to use the high-speed parallel computing power of quantum computers to more quickly discover community structures from the network has become an urgent problem to be solved. Summary of the invention
[0004] The purpose of the present invention is to provide a community discovery method and related devices based on the Grover search algorithm, aiming to accelerate the community discovery algorithm by utilizing the high-speed parallel computing capability of quantum computers.
[0005] An embodiment of the present invention provides a community discovery method based on a Grover search algorithm, the method comprising:
[0006] The target quantum state is prepared based on the node distribution characteristics of the network; wherein the node distribution characteristics include the sequence number of each node in the network and the connection relationship between the nodes, and the target quantum state includes the modularity gain of each group of adjacent nodes in the network, and the modularity gain represents the change in network modularity caused by merging the group of adjacent nodes into one community node;
[0007] Using the Grover search algorithm to search for partial components whose modularity gain is greater than a preset threshold from the target quantum state, merging a group of adjacent nodes corresponding to the partial components into a community node, and updating the network;
[0008] Return to the step of preparing the target quantum state based on the node distribution characteristics of the network until the modularity gain of any group of adjacent nodes in the network is not greater than 0, and take the multiple nodes included in any of the community nodes as a community in the network.
[0009] Optionally, node i and the jth node h adjacent to node i are ij When merging into one community node, the modularity gain Δ i,h Calculated based on the following formula:
[0010]
[0011] Where m represents the total number of edges in the network; k i,in =k i,h , indicating that node i and node h ij The weight of the edge (i, j) between them; represents the degree of node i; Represents node h ij The degree of the community node c; s represents the sparsity of the network.
[0012] Optionally, preparing a target quantum state based on a node distribution feature of a network includes:
[0013] Based on the node distribution characteristics of the network, the first quantum state, the second quantum state and the third quantum state are prepared in sequence; wherein the first quantum state includes the sequence number of the jth node adjacent to the node i |h ij >, the second quantum state includes the degree of the node i |k i > and node h ij Degree|k h >, the third quantum state includes the weight of edge (i, j) |k i,h >
[0014] The first quantum state, the second quantum state and the third quantum state are evolved based on the modularity gain of each group of adjacent nodes to obtain a target quantum state.
[0015] Optionally, the preparing the first quantum state, the second quantum state and the third quantum state in sequence based on the node distribution characteristics of the network includes:
[0016] An adjacency matrix is constructed based on the node distribution characteristics of the network; wherein the position of a non-zero element in the adjacency matrix indicates that there is a connection relationship between the corresponding two nodes, and the value of the non-zero element indicates the weight of the edge corresponding to the connection relationship;
[0017] The quantum state encoding is performed based on the position of the non-zero elements in the adjacency matrix to obtain the quantum state containing |i>|j>|h ij >The first quantum state of the term;
[0018] The first quantum state is evolved based on the value of the non-zero element to obtain a quantum state containing |i>|k i >|k h The second quantum state of the term > and the second quantum state containing |i>|k i,h >The third quantum state of the term.
[0019] Optionally, the encoding includes |i>|j>|h ij The first quantum state of the term > is n represents the number of nodes in the network; the first quantum state, the second quantum state and the third quantum state are evolved based on the modularity gain of each group of adjacent nodes to obtain a target quantum state, including:
[0020] Construct the modularity gain Δ i,h The corresponding quantum arithmetic expression module is used, and the quantum arithmetic expression module is used based on the |i>|j>|h ij >item, described|i>|k i >|k h >Item and the |i>|k i,h > item to perform quantum state evolution and obtain the target quantum state
[0021] Optionally, the first quantum state |h ij >term, the second quantum state in |k i > item,|k h >term and the |k i,h >items are stored in groups in a quantum random access memory; after the step of updating the network in each iteration step, the data stored in the quantum random access memory is updated.
[0022] Optionally, searching the target quantum state for a partial component whose modularity gain is greater than a preset threshold by using a Grover search algorithm, and merging a group of adjacent nodes corresponding to the partial component into a community node, includes:
[0023] Using a Grover search algorithm, searching for a partial component of an initial value whose modularity gain is greater than a preset threshold from the target quantum state;
[0024] Updating the current value of the preset threshold to the modularity gain corresponding to the partial component, and returning to the step of searching the target quantum state for a partial component whose modularity gain is greater than the preset threshold by using the Grover search algorithm until the current value of the preset threshold remains unchanged;
[0025] A group of adjacent nodes corresponding to the partial components when the current value of the preset threshold remains unchanged are merged into one community node.
[0026] Another embodiment of the present invention provides a community discovery device based on a Grover search algorithm, the device comprising:
[0027] A preparation module, used to prepare a target quantum state based on the node distribution characteristics of the network; wherein the node distribution characteristics include the sequence number of each node in the network and the connection relationship between the nodes, and the target quantum state includes the modularity gain of each group of adjacent nodes in the network, and the modularity gain represents the change in network modularity caused by merging the group of adjacent nodes into one community node;
[0028] A search module, used to search for a partial component whose modularity gain is greater than a preset threshold from the target quantum state using a Grover search algorithm, merge a group of adjacent nodes corresponding to the partial component into a community node, and update the network;
[0029] The community discovery module is used to return to the step of preparing the target quantum state based on the node distribution characteristics of the network until the modularity gain of any group of adjacent nodes in the network is not greater than 0, and then the multiple nodes included in any of the community nodes are regarded as a community in the network.
[0030] Yet another embodiment of the present invention provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the method described in any one of the above embodiments when running.
[0031] Yet another embodiment of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the method described in any one of the above embodiments.
[0032] Compared with the prior art, the present invention provides a community discovery method and related devices based on the Grover search algorithm. In this scheme, the target quantum state can be prepared based on the node distribution characteristics of the network first; the node distribution characteristics include the serial number of each node in the network and the connection relationship between the nodes, the target quantum state includes the modularity gain of each group of adjacent nodes in the network, and the modularity gain represents the network modularity change caused by merging the group of adjacent nodes into a community node; then the Grover search algorithm is used to search for the partial components with modularity gain greater than the preset threshold from the target quantum state, merge a group of adjacent nodes corresponding to the partial components into a community node, and update the network; return to execute the step of preparing the target quantum state based on the node distribution characteristics of the network, until the modularity gain of any group of adjacent nodes in the network is not greater than 0, and the multiple nodes included in any community node are regarded as a community in the network. Thereby, not only the high-speed parallel computing capability of quantum computers is brought into play, but also the secondary acceleration effect of the Grover search algorithm on the classical search algorithm is utilized, effectively realizing a more efficient community discovery than the classical algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A network block diagram of a community discovery system based on the Grover search algorithm provided by an embodiment of the present invention;
[0034] Figure 2 A flowchart of a community discovery method based on the Grover search algorithm provided in an embodiment of the present invention;
[0035] Figure 3 A schematic diagram of node merging in a network provided by an embodiment of the present invention;
[0036] Figure 4 A specific execution flow chart of a Grover search algorithm provided by an embodiment of the present invention;
[0037] Figure 5 A schematic diagram of the structure of a quantum random access memory provided by an embodiment of the present invention;
[0038] Figure 6 A schematic diagram of another node merging in a network provided by an embodiment of the present invention;
[0039] Figure 7 A structural diagram of a community discovery device based on the Grover search algorithm provided by an embodiment of the present invention;
[0040] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, but should not be construed as limiting the present invention.
[0042] Figure 1 1 is a network block diagram of a community discovery system based on a Grover search algorithm provided by an embodiment of the present invention. The community discovery system may include a network 110, a server 120, a wireless device 130, a client 140, a storage 150, a classical computing unit 160, a quantum computing unit 170, and may also include additional memories, classical processors, quantum processors, and other devices not shown.
[0043] The network 110 is a medium for providing communication links between various devices and computers connected together in the community discovery system based on the Grover search algorithm, including but not limited to the Internet, corporate intranet, local area network, mobile communication network and their combination. The connection method can be wired, wireless communication links or optical fiber cables, etc.
[0044] The server 120, the wireless device 130 and the client 140 are conventional data processing systems, which may contain data and applications or software tools for performing conventional computing processes. The client 140 may be a personal computer or a network computer, so the data may also be provided by the server 120. The wireless device 130 may be a smart phone, a tablet, a laptop, a smart wearable device, etc. The storage unit 150 may include a database 151, which may be configured to store data such as quantum bit parameters, quantum logic gate parameters, quantum circuits, quantum programs, etc.
[0045] The classical computing unit 160 (quantum computing unit 170) may include a classical processor 161 (quantum processor 171) for processing classical data (quantum data) and a memory 162 (memory 172) for storing classical data (quantum data). The classical data (quantum data) may be a boot file, an operating system image, and an application 163 (application 173). The application 163 (application 173) may be used to implement a quantum algorithm compiled by a community discovery method based on a Grover search algorithm according to an embodiment of the present invention.
[0046] Any data or information stored or generated in the classical computing unit 160 (quantum computing unit 170) can also be configured to be stored or generated in another classical (quantum) processing system in a similar manner, and any application program executed by it can also be configured to be executed in another classical (quantum) processing system in a similar manner.
[0047] It should be noted that a true quantum computer is a hybrid structure, which includes at least Figure 1There are two major parts in it: the classical computing unit 160, which is responsible for performing classical computing and control; the quantum computing unit 170, which is responsible for running quantum programs and thus realizing quantum computing.
[0048] The classical computing unit 160 and the quantum computing unit 170 may be integrated into one device or distributed in two different devices. For example, the first device including the classical computing unit 160 runs a classical computer operating system, on which quantum application development tools and services are provided, as well as storage and network services required for quantum applications. Users develop quantum programs through the quantum application development tools and services thereon, and send quantum programs to the second device including the quantum computing unit 170 through the network services thereon. The second device runs a quantum computer operating system, and the code of the quantum program is parsed and compiled into instructions that can be recognized and executed by the quantum processor 170 through the quantum computer operating system. The quantum processor 170 implements the quantum algorithm corresponding to the quantum program according to the instructions.
[0049] The computing unit of the classic processor 161 in the classic computing unit 160 is a CMOS tube based on a silicon chip. This computing unit is not limited by time and coherence, that is, this computing unit is not limited by the length of use and can be used at any time. In addition, in the silicon chip, the number of such computing units is also sufficient. At present, the number of computing units in a classic processor 161 is tens of thousands. The number of computing units is sufficient and the computing logic that can be selected by the CMOS tube is fixed, such as: AND logic. When calculating with the help of CMOS tubes, a large number of CMOS tubes are combined with limited logic functions to achieve the calculation effect.
[0050] The basic computing unit of the quantum processor 171 in the quantum computing unit 170 is a quantum bit. The input of the quantum bit is limited by coherence and coherence time, that is, the quantum bit is limited by the duration of use and is not available at any time. Making full use of the quantum bit within the available duration of use of the quantum bit is a key problem in quantum computing. In addition, the number of quantum bits in a quantum computer is one of the representative indicators of the performance of the quantum computer. Each quantum bit realizes the computing function through the logical function configured on demand. In view of the limited number of quantum bits, the logical functions in the field of quantum computing are diverse, such as: Hadamard gate (Hadamard gate, H gate), Pauli-X gate (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), X gate, RY gate, RZ gate, CNOT gate, CR gate, iSWAP gate, Toffoli gate, etc. In quantum computing, it is necessary to use limited quantum bits combined with a variety of logical function combinations to achieve the computing effect.
[0051] Based on these differences, the design of CMOS tubes by classical logic functions and the design of quantum bits by quantum logic functions are significantly and essentially different. The design of CMOS tubes by classical logic functions does not need to consider the individuality of CMOS tubes. For example, the representation of CMOS tubes in silicon chips is the individual identification, position, and usable life of each CMOS tube. Therefore, the classical algorithm composed of classical logic functions only expresses the operational relationship of the algorithm, but does not express the algorithm's dependence on individual CMOS tubes.
[0052] When quantum logic functions act on qubits, the individuality of qubits needs to be considered, such as the individual identification of the qubit in the quantum chip, its position, its relationship with surrounding qubits, and the usable time of each qubit. Therefore, the quantum algorithm composed of quantum logic functions not only expresses the computational relationship of the algorithm, but also expresses the algorithm's dependence on individual qubits.
[0053] Quantum chips can include quantum bits and channels for regulating quantum bits. Quantum logic gates are implemented through analog signals. Different combinations of analog signals are applied to quantum bits through channels for regulating quantum bits, thereby realizing quantum circuits with different functions and completing data processing. Therefore, the design of quantum logic functions acting on quantum bits (including the design of whether quantum bits are used or not and the design of the efficiency of each quantum bit) is the key to improving the computing performance of quantum computers, and special designs are required. This is also the uniqueness of quantum algorithms based on quantum logic functions, which is essentially and significantly different from classical algorithms based on classical logic functions. The above-mentioned design for quantum bits is a technical issue that ordinary computing devices do not need to consider or face.
[0054] Community discovery algorithms are a method for identifying and analyzing node clusters in a network, and are mainly used in social networks, information flow networks, and other fields. For example, in sensitive fields such as finance and medicine, community discovery can be used to identify abnormal behavior or potential fraudulent activities, thereby enhancing the security of the system. The purpose of these algorithms is to divide the nodes in the network into several communities, where the nodes within each community are more interconnected, while the nodes between different communities are less connected, that is, there is a characteristic of "tight inside and loose outside".
[0055] There are many types of community discovery algorithms, including methods based on modularity optimization, spectral bisection, deep learning methods, etc. Each method has its specific application scenarios and advantages. For example, the Louvain algorithm is widely used due to its high efficiency and wide applicability. In addition, with the development of technology, deep learning methods have also begun to be applied to community discovery to process more complex network data and extract deeper network features. In short, community discovery algorithms are an important tool in the field of network science and data analysis, which can help technicians extract valuable information from large amounts of network data to support decision making and business optimization.
[0056] However, when faced with large-scale network structures, it is very difficult for classical computers to run these community discovery algorithms due to the large number of nodes and complex connection relationships in the network. Quantum computers are physical devices that follow the laws of quantum mechanics to perform high-speed mathematical and logical operations, store and process quantum information, and have the ability to process mathematical problems more efficiently than classical computers. So, how to use the high-speed parallel computing power of quantum computers to discover community structures from the network more quickly has gradually become a technical problem to be solved. Therefore, there is a need for a community discovery algorithm that can be accelerated by using the high-speed parallel computing power of quantum computers. Based on this, the present invention proposes a community discovery method and related devices based on the Grover search algorithm.
[0057] See also Figure 2 , Figure 2 A community discovery method based on a Grover search algorithm is provided in an embodiment of the present invention, and the method comprises the following steps:
[0058] Step 201, preparing a target quantum state based on the node distribution characteristics of the network;
[0059] Among them, the node distribution characteristics include the serial number of each node in the network and the connection relationship between the nodes, and the target quantum state includes the modularity gain of each group of adjacent nodes in the network. The modularity gain represents the change in network modularity caused by merging the group of adjacent nodes into a community node.
[0060] In the field of community discovery, "community discovery" is equivalent to "grouping nodes". Modularity is a commonly used standard for measuring the quality of node grouping. The higher the modularity, the more the detected community conforms to the characteristics of "tight inside and loose outside", and the better the grouping quality. Specifically, in this field, when calculating the modularity of a network, a random network with the same node degree distribution as the network can be constructed as a reference. The physical meaning of modularity can be understood as: within the community, the difference between the number of edges in the actual grouping and the number of edges in the random grouping case. If the difference is relatively large, it means that the density inside the community is significantly higher than the random situation, and the quality of community division is better. The range of modularity values is usually between [-0.5, 1]. If the number of edges inside the community obtained by actual grouping exceeds the expected number of edges obtained by random allocation, the modularity is a positive number. If it does not exceed, it is a negative number.
[0061] For a given network G = (V, E) and community partition c, its modularity Q can be calculated based on the following formula:
[0062]
[0063] Where m represents the total number of edges in the network, A ij It is used to indicate the existence of an actual edge between node i and node j. If there is an edge between node i and node j, then A ij =1, otherwise A ij =0; k i represents the degree of node i, k j represents the degree of node j; δ(c i , c j ) is the indicator function. When nodes i and j belong to the same community, δ(c i , c j )=1, otherwise δ(c i , c j )=0.
[0064] When calculating the modularity of a network, we can first calculate the degree k of each node. i and the total number of edges in the network m, and then for each pair of nodes i and j, calculate A ij and The difference is the value of the module Q, and only when nodes i and j belong to the same community, the difference is added to the module Q, and then multiplied by After normalization, the final modularity Q can be obtained.
[0065] Correspondingly, when a group of adjacent nodes in the network are merged as a merged community node, the modularity of the network will change accordingly. The change in network modularity caused by node merging is called modularity gain.
[0066] As an implementation method of the embodiment of the present invention, node i and the jth node h adjacent to node i are connected. ij When merging into one community node, the modularity gain Δ i,h It can be calculated based on the following formula:
[0067]
[0068] Where m represents the total number of edges in the network; k i,in =k i,h , indicating that node i and node h ij The weight of the edge (i, j) between them; represents the degree of node i; Represents node h ij The degree of the community node c; s represents the sparsity of the network.
[0069] For example, Figure 3 In the network shown in the figure, based on the initial node distribution characteristics of the network, it can be seen that there are 7 nodes and 8 edges with serial numbers [1, 2, 3, 4, 5, 6, 7], so m = 8; among them, the weight of each edge is 1, so based on the connection relationship between each node, the degree of each node can be obtained, which is k 1 =k 4 =3, k 2 =k 3 =k 5 =k 6 =k 7 =2. Since the nodes have not been grouped and divided into communities, each node can be regarded as a community. Based on the above modularity calculation formula, the initial modularity Q of the network can be calculated. 0 ,for:
[0070]
[0071] Then if node 1 and node 2 are merged into one community node, node 1 and node 2 are in the same community at this time, and the modularity calculation corresponding to this part is also different from the above formula. The modularity Q corresponding to the current community division method of the network is 1 Can be:
[0072]
[0073] Then, the change in network modularity caused by merging node 1 and node 2 into one community node is (-0.07)-(-0.148)=0.078.
[0074] Correspondingly, the above modularity gain formula can also be used to calculate Δ 1,2 , the weight k of the edge (1, 2) between node 1 and node 2 1,in is 1, the degree k of node 1 1 is 3, the community node where node 2 is currently located is node 2 itself, and its degree ∑ tot is 2, then Δ 1,2 Specifically:
[0075]
[0076] Then, based on the sequence number of each node in the network and the connection relationship between the nodes, the modularity gain of each group of adjacent nodes in the network can be calculated, and the target quantum state including the above modularity gain can be prepared, thereby utilizing the high-speed parallel computing power of quantum computers to accelerate community discovery.
[0077] Step 202: Use the Grover search algorithm to search for partial components whose modularity gain is greater than a preset threshold from the target quantum state, merge a group of adjacent nodes corresponding to the partial components into a community node, and update the network.
[0078] Specifically, the Grover search algorithm is a quantum search algorithm that is mainly used to find specific elements in an unsorted database. Compared with the linear time complexity O(N) of the classical search algorithm, the Grover search algorithm can use quantum superposition and quantum entanglement characteristics to find specific elements in an unsorted database. The search can be completed in a short time, which has significant advantages when processing large-scale data.
[0079] In a specific implementation, first, a method for representing each modularity gain Δ i,h The uniform superposition state As the target quantum state, n represents the number of nodes in the network and s represents the sparsity of the network. Then a quantum oracle function O is constructed, which can identify the target element |Δ i,h >x>. When the input state is the target element, the function flips its phase, otherwise it remains unchanged.
[0080] Furthermore, Grover iteration can be performed, that is, the "reflection-diffusion" operation can be iteratively performed, which can be performed through the following two steps:
[0081] 1. Phase flip: that is, flip the phase of the target element through the Oracle function O.
[0082] 2. Diffusion operation: that is, reflection operation is performed on the uniform superposition state. The specific calculation formula can be as follows:
[0083] D=2|ψ><ψ|-I
[0084] Since at each iteration, the target element |Δ i,h The amplitude of >x> will be amplified, making it easier to detect when measuring. Then, by repeating the above Grover iteration Then the evolved quantum state is measured, and the result is the target element |Δ i,h >x>. The preset threshold x can be an empirical value or a variable parameter that is continuously updated during the execution of the community discovery algorithm, which is not specifically limited here. Similarly, the quantum oracle function O can be constructed by Δ i,h A corresponding quantum comparator is used to implement it, which will not be elaborated here.
[0085] Then, after using the Grover search algorithm to search for the partial components whose modularity gain is greater than the preset threshold from the target quantum state, a group of adjacent nodes corresponding to the partial components can be determined, and the group of adjacent nodes can be merged into a community node to update the network. It can be seen that each time the Grover search algorithm and node merging steps are run, the structure of the network is constantly simplified and its modularity is gradually increasing; thus, through a limited number of iterative operations, the community structure in the network can be quickly discovered.
[0086] Return to step 201 of preparing the target quantum state based on the node distribution characteristics of the network, until the modularity gain of any group of adjacent nodes in the network is not greater than 0, execute:
[0087] Step 203: taking the multiple nodes included in any of the community nodes as a community in the network.
[0088] Specifically, after updating the network, the step of preparing the target quantum state based on the node distribution characteristics of the network can be returned, and the new target quantum state can be phase-flipped and diffused using the Grover search algorithm to determine the new nodes to be merged, and merge them into new community nodes, thereby continuously updating the network. Until the modularity gain of any group of adjacent nodes in the network is not greater than 0, it means that the current node grouping method has reached the best, and at this time, merging any group of adjacent nodes will not increase the modularity of the network again. Then the multiple nodes included in any merged community node can be used as a community in the network, so that multiple community structures in the network can be discovered based on multiple community nodes.
[0089] It can be seen that in the solution provided by the embodiment of the present invention, compared with the linear time complexity O(N) of the classical search algorithm, the Grover search algorithm can use the quantum superposition state and quantum entanglement characteristics to The search can be completed in a short time, which has significant advantages in processing large-scale data. This not only takes advantage of the high-speed parallel computing capabilities of quantum computers, but also utilizes the quadratic acceleration effect of the Grover search algorithm on the classical search algorithm, effectively achieving more efficient community discovery than the classical algorithm.
[0090] As an implementation method of the embodiment of the present invention, Figure 4 As shown, the method of searching for a partial component whose modularity gain is greater than a preset threshold from the target quantum state by using the Grover search algorithm, and merging a group of adjacent nodes corresponding to the partial component into a community node, may include the following steps:
[0091] Step 401 : using a Grover search algorithm to search for a partial component of an initial value whose modularity gain is greater than a preset threshold from the target quantum state.
[0092] Step 402: Update the current value of the preset threshold to the modularity gain corresponding to the partial component.
[0093] Return to step 401 of searching the target quantum state for a partial component whose modularity gain is greater than a preset threshold by using the Grover search algorithm, until the current value of the preset threshold remains unchanged, and then execute:
[0094] Step 403: merge a group of adjacent nodes corresponding to some components when the current value of the preset threshold remains unchanged into one community node.
[0095] Specifically, in order to make each node merger make the greatest contribution to the improvement of the modularity of the current network, thereby further accelerating community discovery, the preset threshold of the modularity gain in this scheme can be a variable x, and its initial value can be set to 0 or an empirical value greater than 0. The specific value of the initial value of the variable x is not limited here.
[0096] Furthermore, in each iterative step of searching for partial components whose modularity gain is greater than a preset threshold and merging a corresponding set of community nodes, the variable x can be used to determine the current maximum value of the modularity gain. The specific idea is: first use the Grover search algorithm to search for any partial component of the initial value of the modularity gain greater than the preset threshold from the target quantum state, and update the current value of the preset threshold to the modularity gain obtained by the first search, so that the value of the preset threshold continues to increase in the next cycle.
[0097] Then return to execute the Grover search algorithm, search for the partial components of the modularity gain greater than the modularity gain obtained in the first search from the target quantum state, and repeat this process multiple times. When a larger modularity gain cannot be found in a certain cycle, the current value of the preset threshold can be kept unchanged, that is, the maximum modularity gain, and a group of adjacent nodes corresponding to the partial components containing the modularity gain is determined. Then merge the group of adjacent nodes with the largest modularity gain as a community node in the network, so that the node merger in the current iteration step can make the greatest contribution to the improvement of the modularity of the network.
[0098] In this embodiment, by setting a threshold value of modularity gain with a variable value, the Grover search algorithm can be used to find the maximum value of modularity gain in a cyclic manner, so that the node merger in each iteration step can make the greatest contribution to the improvement of the modularity of the network. This not only further accelerates community discovery, but also effectively improves the effect of community discovery.
[0099] As an implementation method of the present invention, the first quantum state|h ij >term, the second quantum state in |k i > item,|k h >term and the |k i,h >items are stored in groups in a quantum random access memory; after the step of updating the network in each iteration step, the data stored in the quantum random access memory is updated.
[0100] Quantum Random Access Memory (QRAM) is an important concept in quantum computing. It is similar to random access memory in classical computing, but has specific functions and uses in quantum computing. QRAM allows efficient storage and retrieval of data during quantum computing and is a key component for implementing many quantum algorithms.
[0101] QRAM allows quantum computers to store and retrieve data efficiently and supports large-scale data processing, including: the data address to be queried can be specified through the quantum state. Due to the characteristics of the quantum superposition state, QRAM can use quantum superposition and quantum entanglement to achieve parallel access to multiple addresses, thereby significantly speeding up data retrieval; and QRAM can also support data update operations. Through quantum logic gate operations, data updates and modifications can be achieved on the quantum state. Therefore, QRAM is a basic component of some complex quantum algorithms (such as Grover search algorithm and Shor decomposition algorithm), which can help these algorithms run effectively. Specifically, a QRAM structure provided by an embodiment of the present invention can be used as follows: Figure 5 shown.
[0102] The step 201 of preparing the target quantum state based on the node distribution characteristics of the network may include the following steps:
[0103] Step 211, based on the node distribution characteristics of the network, sequentially prepare a first quantum state, a second quantum state and a third quantum state;
[0104] The first quantum state includes the serial number of the jth node adjacent to the node i. ij >, the second quantum state includes the degree of the node i |k i > and node h ij Degree of k h >, the third quantum state includes the weight of edge (i, j) |k i,h >.
[0105] Specifically, in order to prepare a target quantum state including the modularity gain of each group of adjacent nodes in the network, based on the modularity gain Δ i, The calculation formula of h It is certain that at least the number of edges in the network, m, and the number of nodes i and h are required. ij The weight information k of the edge (i, j) between i,in , the degree information k of node i i , and node h ij The degree information of the community node c∑ tot , where m remains constant throughout the algorithm.
[0106] Then, in one implementation, based on the node distribution characteristics of the network, a sequence number of the jth node adjacent to the node i can be prepared first. ij >The first quantum state, including the degree of node i |k i > and node h ij Degree|k h > the second quantum state, and the weight of the edge (i, j) |k i,h >The third quantum state; then the first quantum state, the second quantum state and the third quantum state are entangled and evolved by quantum computing, and then the uniformly superimposed target quantum state is calculated.
[0107] Specifically, the preparing the first quantum state, the second quantum state and the third quantum state in sequence based on the node distribution characteristics of the network may include the following steps:
[0108] Step 501, constructing an adjacency matrix based on the node distribution characteristics of the network;
[0109] The position of the non-zero element in the adjacency matrix indicates that there is a connection relationship between the corresponding two nodes, and the value of the non-zero element indicates the weight of the edge corresponding to the connection relationship.
[0110] For example, Figure 3 For the network shown on the left, the following adjacency matrix A can be constructed based on its node distribution characteristics:
[0111]
[0112] It can be seen that before the nodes are merged, the weight of each edge is 1. The position of the "1" element in the adjacency matrix A indicates that there is a connection relationship between the corresponding two nodes. For example, the matrix element A 12 and A 21 If it is 1, it means there is a connection relationship between node 1 and node 2.
[0113] Step 502, performing quantum state encoding based on the positions of non-zero elements in the adjacency matrix to obtain a matrix containing |i>|j>|h ij >The first quantum state of the term.
[0114] Then, based on the position of the "1" element in the adjacency matrix A, multiple quantum bits can be encoded in quantum state. For example, the oracle function O 1 Encoding multiple quantum states:
[0115] Specifically, it may include: 1 |1>|1>|0>=|1>|1>|2>, which means the first node adjacent to node 1 is numbered 2. 1 |1>|2>|0>=|1>|2>|3>,O 1 |1>|3>|0>=|1>|3>|4>. Correspondingly, if the number of adjacent nodes of a node is less than the sparsity s=3, such as node 3 is only adjacent to node 1 and node 2, then through the Oracle function O 1 Encoding O 1 |3>|1>|0>=|3>|1>|1>,O 1 After |3>|2>|0>=|3>|2>|2>, the column number "3" of the first "0" element in the third row of the adjacency matrix A can be used as the serial number of the third node adjacent to it, denoted as O 1 |3>|3>|0>=|3>|3>|3>. Similarly, O 1 |5>|3>|0>=|5>|3>|1>,…, other quantum states will not be described in detail here.
[0116] In a specific embodiment, the encoded content includes |i>|j>|h ij The first quantum state of the term can be a uniform superposition state Then, the above-mentioned uniform superposition state can be prepared based on a coding module composed of multiple RY gates with different rotation angles. The specific structure of the coding module is not specifically limited here.
[0117] For example, the first quantum state obtained by encoding can be:
[0118]
[0119] The specifics can be as follows:
[0120]
[0121] Step 503: Evolving the first quantum state based on the value of the non-zero element to obtain a quantum state containing |i>|k i >|k h The second quantum state of the term > and the second quantum state containing |i>|k i,h >The third quantum state of the term.
[0122] Specifically, based on the values of the non-zero elements in the adjacency matrix A, the Oracle function O can be used. 2 Evolution obtains each node i or h ij The quantum state of the degree, for example, O 2 |1>|0>=|1>|3>, which means the degree of node 1 is 3, O 2 |2>|0>=|2>|2>,…,O 2 |7>|0>=|7>|2>, the quantum states |i>, |j>, |h obtained by the above steps are ij >、|k i > and |k h >Can be stored separately in multiple groups of quantum bits.
[0123] Correspondingly, you can also use the Oracle function O 3 Evolving the quantum state of the weight of each edge (i, j), for example, O 3 |1>|2>|0>=|1>|2>|1>, which means the weight of the first edge adjacent to node 1 is 1. 3 |1>|3>|0>=|1>|3>|1>,…,O 3 |1>|7>|0>=|1>|7>|0>. Similarly, the evolved quantum state |k i,h >Can be stored in another set of quantum bits.
[0124] For example, Figure 6As shown, in a certain iteration step, Figure 6 The network shown on the left has completed multiple node mergers, resulting in Figure 6 The network shown on the right, in which nodes 1, 2 and 3 have been merged into one community node, nodes 4 and 7 have been merged into one community node, and nodes 5 and 6 have been merged into one community node. At this time, the adjacency matrix A′ corresponding to the network is as follows:
[0125]
[0126] Then, you can use the Oracle function O 1 The following quantum state is obtained by encoding: 1 |1>|1>|0>=|1>|1>|1>, O 1 |1>|2>|0>=|1>|2>|2>、O 1 |1>|3>|0>=|1>|3>|3>;O 1 |2>|1>|0>=|2>|1>|1>、O 1 |2>|2>|0>=|2>|2>|2>, O 1 |2>|3>|0>=|2>|3>|3>;O 1 |3>|1>|0>=|3>|1>|2>、O 1 |3>|2>|0>=|3>|2>|3>、O 1 |3>|3>|0>=|3>|3>|1>. For another example, the Oracle function O 3 The evolution results in the following quantum state: 3 |1>|1>|0>=|1>|1>|6>、O 3 |1>|2>|0>=|1>|2>|1>、O 3 |1>|3>|0>=|1>|3>|6>;O 3 |2>|1>|0>=|2>|1>|1>、O 3 |2>|2>|0>=|2>|2>|2>, O 3 |2>|3>|0>=|2>|3>|2>;O 3 |3>|1>|0>=|3>|1>|0>、O 3 |3>|2>|0>=|3>|2>|2>、O 3 |3>|3>|0>=|3>|3>|2>.
[0127] Step 2012: Evolving the first quantum state, the second quantum state, and the third quantum state based on the modularity gain of each group of adjacent nodes to obtain a target quantum state.
[0128] Specifically, the above step 2012 may include:
[0129] Construct the modularity gain Δ i,h The corresponding quantum arithmetic expression module is used, and the quantum arithmetic expression module is used based on the |i>|j>|h ij >item, described|i>|k i >|k h >Item and the |i>|k i,h > item to perform quantum state evolution and obtain the target quantum state
[0130] For example, to calculate Δ 1,2 , we need to know k 1 , k 1,in and∑ tot ,in:
[0131]
[0132] k 1,in =k i,h =k 1,2
[0133]
[0134] Then based on the quantum state prepared above, |i>|j>|h ij > item, |i>|k i >|k h >term and |i>|k i,h >, then k can be calculated 1 , k 1,in and∑ tot , thus obtaining Δ 1,2 Then based on the modularity gain Δ i,h Solving the formula can construct the corresponding quantum arithmetic expression module, and then apply the quantum arithmetic expression module to the quantum state |i>|j>|h ij >|k i >|k h >|k i,h >, the target quantum state with uniform superposition can be prepared
[0135] In this embodiment, an adjacency matrix can be constructed based on the node distribution characteristics of the network, and a matrix containing |i>|j>|h can be prepared based on the adjacency matrix. ij >term, and evolving it can obtain the first quantum state containing |i>|k i >|k h The second quantum state of the term > and the second quantum state containing |i>|k i,h>The third quantum state of the term, and then using the modularity gain Δ i,h The quantum arithmetic expression module constructed by solving the formula evolves the above quantum state, thereby preparing the target quantum state of uniform superposition through quantum computing. The execution efficiency of the community discovery algorithm is further improved.
[0136] See also Figure 7 , Figure 7 A community discovery device based on a Grover search algorithm is provided in an embodiment of the present invention, and the device may include:
[0137] Preparation module 701, used to prepare target quantum state based on node distribution characteristics of the network;
[0138] Among them, the node distribution characteristics include the serial number of each node in the network and the connection relationship between the nodes, and the target quantum state includes the modularity gain of each group of adjacent nodes in the network. The modularity gain represents the change in network modularity caused by merging the group of adjacent nodes into a community node.
[0139] The search module 702 is used to use the Grover search algorithm to search for a partial component whose modularity gain is greater than a preset threshold from the target quantum state, merge a group of adjacent nodes corresponding to the partial component into a community node, and update the network.
[0140] The community discovery module 703 is used to return to the step of preparing the target quantum state based on the node distribution characteristics of the network until the modularity gain of any group of adjacent nodes in the network is not greater than 0, and then the multiple nodes included in any of the community nodes are regarded as a community in the network.
[0141] Regarding the specific functions and effects achieved by the community discovery device based on the Grover search algorithm, please refer to the other implementations of this specification for comparative explanation, and no further details will be given here. The various modules in the community discovery device based on the Grover search algorithm can be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0142] See also Figure 8 , the present specification also provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the community discovery method based on the Grover search algorithm in any of the above embodiments when executing the computer program. Figure 8, the computer device may be a classical computer. The computer device may also be a quantum computer.
[0143] The embodiments of the present specification also provide a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computer, the computer executes the community discovery method based on the Grover search algorithm in any of the above embodiments.
[0144] The embodiments of this specification also provide a computer program product including instructions, which, when executed by a computer, enables the computer to execute the community discovery method based on the Grover search algorithm in any of the above embodiments.
[0145] It should be understood that the specific examples in this specification are only intended to help those skilled in the art to better understand the implementation methods of this specification, rather than to limit the scope of the present invention.
[0146] It can be understood that in the various implementations of this specification, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the implementation methods of this specification.
[0147] It can be understood that the various embodiments described in this specification can be implemented individually or in combination, and the embodiments of this specification are not limited to this.
[0148] Unless otherwise specified, all technical and scientific terms used in the embodiments of this specification have the same meaning as those generally understood by those skilled in the art of the technical field of this specification. The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the scope of this specification. The term "and / or" used in this specification includes any and all combinations of one or more related listed items. The singular forms of "a", "above", and "the" used in the embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0149] It can be understood that the processor of the embodiment of this specification can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method implementation can be completed by the hardware integrated logic circuit or software instructions in the processor. The above processor can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiment of this specification can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of this specification can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor are combined and executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0150] It is understood that the memory in the embodiments of this specification may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (programmable ROM, PROM), an erasable programmable read-only memory (erasablePROM, EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory may be a random access memory (RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0151] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this specification.
[0152] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method implementation methods and will not be repeated here.
[0153] In the several embodiments provided in this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0155] In addition, each functional unit in each embodiment of the present specification may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0156] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this specification, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of this specification. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0157] The above is only a specific implementation of this specification, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in this specification, which should be included in the protection scope of this specification. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A community discovery method based on Grover search algorithm, characterized in that: The method comprises: The target quantum state is prepared based on the node distribution characteristics of the network; wherein the node distribution characteristics include the sequence number of each node in the network and the connection relationship between the nodes, and the target quantum state includes the modularity gain of each group of adjacent nodes in the network, and the modularity gain represents the change in network modularity caused by merging the group of adjacent nodes into one community node; Using the Grover search algorithm to search for partial components whose modularity gain is greater than a preset threshold from the target quantum state, merging a group of adjacent nodes corresponding to the partial components into a community node, and updating the network; Return to the step of preparing the target quantum state based on the node distribution characteristics of the network until the modularity gain of any group of adjacent nodes in the network is not greater than 0, and take the multiple nodes included in any of the community nodes as a community in the network.
2. The method according to claim 1, characterized in that Set node i and the jth node h adjacent to node i ij When merging into one community node, the modularity gain Δ i,h Calculated based on the following formula: Where m represents the total number of edges in the network; k i,in =k i,h , indicating that node i and node h ij The weight of the edge (i, j) between them; represents the degree of node i; Represents node h ij The degree of the community node c; s represents the sparsity of the network.
3. The method according to claim 1, characterized in that The method of preparing a target quantum state based on the node distribution characteristics of the network includes: Based on the node distribution characteristics of the network, the first quantum state, the second quantum state and the third quantum state are prepared in sequence; wherein the first quantum state includes the sequence number of the jth node adjacent to the node i |h ij >, the second quantum state includes the degree of the node i |k i > and node h ij Degree|k h >, the third quantum state includes the weight of edge (i, j) |k i,h > The first quantum state, the second quantum state and the third quantum state are evolved based on the modularity gain of each group of adjacent nodes to obtain a target quantum state.
4. The method according to claim 3, characterized in that The method of sequentially preparing a first quantum state, a second quantum state, and a third quantum state based on the node distribution characteristics of the network includes: An adjacency matrix is constructed based on the node distribution characteristics of the network; wherein the position of a non-zero element in the adjacency matrix indicates that there is a connection relationship between the corresponding two nodes, and the value of the non-zero element indicates the weight of the edge corresponding to the connection relationship; The quantum state encoding is performed based on the position of the non-zero elements in the adjacency matrix to obtain the quantum state containing |i>|j>|h ij >The first quantum state of the term; The first quantum state is evolved based on the value of the non-zero element to obtain a quantum state containing |i>|k i >|k h The second quantum state of the term > and the second quantum state containing |i>|k i,h >The third quantum state of the term.
5. The method according to claim 4, characterized in that The encoding includes |i>|j>|h ij The first quantum state of the term > is n represents the number of nodes in the network; the first quantum state, the second quantum state and the third quantum state are evolved based on the modularity gain of each group of adjacent nodes to obtain a target quantum state, including: Construct the modularity gain Δ i,h The corresponding quantum arithmetic expression module is used, and the quantum arithmetic expression module is used based on the |i>|j>|h ij >item, described|i>|k i >|k h >Item and the |i>|k i,h > item to perform quantum state evolution and obtain the target quantum state 6. The method according to any one of claims 3 to 5, characterized in that The first quantum state has |h ij >term, the second quantum state in |k i > item,|k h >term and the |k i,h >items are stored in groups in a quantum random access memory; after the step of updating the network in each iteration step, the data stored in the quantum random access memory is updated.
7. The method according to any one of claims 1 to 5, characterized in that The method of using the Grover search algorithm to search for a partial component whose modularity gain is greater than a preset threshold from the target quantum state, and merging a group of adjacent nodes corresponding to the partial component into a community node, includes: Using a Grover search algorithm, searching for a partial component of an initial value whose modularity gain is greater than a preset threshold from the target quantum state; Updating the current value of the preset threshold to the modularity gain corresponding to the partial component, and returning to the step of searching the target quantum state for a partial component whose modularity gain is greater than the preset threshold by using the Grover search algorithm until the current value of the preset threshold remains unchanged; A group of adjacent nodes corresponding to the partial components when the current value of the preset threshold remains unchanged are merged into one community node.
8. A community discovery device based on Grover search algorithm, characterized in that: The device comprises: A preparation module, used to prepare a target quantum state based on the node distribution characteristics of the network; wherein the node distribution characteristics include the sequence number of each node in the network and the connection relationship between the nodes, and the target quantum state includes the modularity gain of each group of adjacent nodes in the network, and the modularity gain represents the change in network modularity caused by merging the group of adjacent nodes into one community node; A search module, used to search for a partial component whose modularity gain is greater than a preset threshold from the target quantum state using a Grover search algorithm, merge a group of adjacent nodes corresponding to the partial component into a community node, and update the network; The community discovery module is used to return to the step of preparing the target quantum state based on the node distribution characteristics of the network until the modularity gain of any group of adjacent nodes in the network is not greater than 0, and then the multiple nodes included in any of the community nodes are regarded as a community in the network.
9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 8 when running.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Superconducting quantum computer-oriented quantum program parallel processing method and operating system
CN115238899A
Optimization method and system for improving community detection calculation performance and storage medium
CN117575067A
Methods and systems for quantum search, computation and memory
US20090164435A1
Cited By
Dynamic management method and system for social group members
CN120821878A
A social group member dynamic management method and system
CN120821878B
Method for searching minimum
US12682271B2
Method for searching minimum
US20230044487A1
