A complete graph counting method based on a hybrid storage architecture

By using a full graph counting method based on a hybrid storage architecture and generating a matrix using object pointing relationships, the problem of low efficiency in manual statistics in existing technologies is solved, and the number of subsets that meet preset conditions in a set can be counted efficiently.

CN118012929BActive Publication Date: 2025-11-14BEIHANG UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410151661.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-02
Publication Date
2025-11-14
Estimated Expiration
2044-02-02

AI Technical Summary

Technical Problem

In existing technologies, manually counting the number of subsets in a set that meet preset conditions is inefficient.

Method used

A full graph counting method based on a hybrid storage architecture is adopted. By obtaining the pointer relationships between objects in the object set, a matrix is ​​generated to count the number of subsets that meet the preset conditions.

Benefits of technology

It enables efficient counting of the number of subsets in a set that meet preset conditions without manual intervention, thus improving statistical efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118012929B_ABST
    Figure CN118012929B_ABST
Patent Text Reader

Abstract

This application discloses a complete graph counting method based on a hybrid storage architecture, relating to the field of data processing technology. The method includes: obtaining a set of objects, each object having a pointing relationship; obtaining a first set corresponding to a first object in the object set, the first set including all second objects pointed to by the first object; obtaining a second set corresponding to the second object, the second set including all objects pointed to by the second object; obtaining the intersection of the first set with each second set; generating a matrix corresponding to the first object based on all intersections; and obtaining the first number of subsets in the object set that satisfy a preset condition based on the matrices corresponding to each of the first objects. The preset condition is that the number of objects in the subset is a preset number, and any two objects in the subset have a pointing relationship, thus improving processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of data processing technology, specifically relating to a complete graph counting method based on a hybrid storage architecture. Background Technology

[0002] In practical applications, it is often necessary to count the number of subsets in a set that meet preset conditions. The set includes multiple elements, each of which is related to at least one other element. The preset conditions are: the number of elements in the subset is a preset number, and any two elements in the subset are related.

[0003] For example, in order to perform social network analysis, the number of user subsets is counted from a set of users. A user subset includes five users, and any two users in the user subset have a relationship (e.g., mother and child, husband and wife, etc.).

[0004] In prior art, staff manually count the number of subsets in a set that meet preset conditions.

[0005] In the process of developing this application, the inventors discovered that the prior art has at least the following problems: because the staff manually counts the number of subsets in a set that meet the preset conditions, the work efficiency is low. Summary of the Invention

[0006] This application aims to provide a complete graph counting method based on a hybrid storage architecture, which at least solves the problem of low work efficiency in prior art due to the manual counting of the number of subsets in a set that meet preset conditions.

[0007] To solve the above-mentioned technical problems, this application is implemented as follows:

[0008] In a first aspect, embodiments of this application provide a complete graph counting method based on a hybrid storage architecture, the method comprising:

[0009] Obtain a collection of objects, the collection of objects comprising multiple objects, each of which has a pointer relationship with at least one other object;

[0010] Obtain the first set corresponding to the first object in the object set, wherein the first set includes all the second objects pointed to by the first object;

[0011] Obtain the second set corresponding to the second object, the second set including all objects pointed to by the second object;

[0012] Obtain the intersection of the first set with each of the second sets, and generate a matrix corresponding to the first object based on all the intersections. The elements in the matrix are used to represent the objects in the intersections.

[0013] Based on the matrices corresponding to each of the first objects, obtain the first number of subsets in the object set that satisfy a preset condition, wherein the preset condition is: the number of objects in the subset is a preset number, and there is a pointing relationship between any two objects in the subset.

[0014] Secondly, embodiments of this application also provide a hybrid storage system for complete graph counting, including: a preprocessing unit, a content-addressable memory, and a storage-computing unit, wherein the preprocessing unit is connected to the content-addressable memory, and the content-addressable memory is connected to the storage-computing unit;

[0015] The preprocessing unit is used to obtain a set of objects, the set of objects including multiple objects, each of which has a pointing relationship with at least one other object;

[0016] The content-addressable memory is used to retrieve a first set corresponding to a first object in the object set, the first set including all second objects pointed to by the first object;

[0017] The content-addressable memory is also used to retrieve a second set corresponding to the second object, the second set including all objects pointed to by the second object;

[0018] The content-addressable memory is also used to obtain the intersection of the first set and each of the second sets respectively, and generate a matrix corresponding to the first object based on all the intersections, wherein the elements in the matrix are used to represent the objects in the intersections;

[0019] The in-memory computing unit is used to obtain the first number of subsets in the object set that satisfy a preset condition based on the matrix corresponding to each of the first objects. The preset condition is that the number of objects in the subset is a preset number, and there is a pointing relationship between any two objects in the subset.

[0020] In this embodiment, by obtaining an object set, wherein the object set includes multiple objects, each object having a pointing relationship with at least one other object, then obtaining a first set corresponding to a first object in the object set, wherein the first set includes all second objects pointed to by the first object, then obtaining a second set corresponding to the second object, wherein the second set includes all objects pointed to by the second object, then obtaining the intersection of the first set with each second set, and generating a matrix corresponding to the first object based on all intersections, wherein the elements in the matrix are used to represent the objects in the intersection, and obtaining the first number of subsets in the object set that satisfy a preset condition based on the matrices corresponding to each of the first objects, wherein the preset condition is: the number of objects in the subset is a preset number, and any two objects in the subset have a pointing relationship, thereby realizing the counting of the number of subsets in a set that satisfy the preset condition without the need for manual processing, solving the problem of low work efficiency caused by the manual counting of the number of subsets in a set that satisfy the preset condition in the prior art. Attached Figure Description

[0021] Figure 1 This is a flowchart illustrating the steps of a complete graph counting method based on a hybrid storage architecture provided in an embodiment of this application.

[0022] Figure 2 This is a flowchart illustrating the specific steps of a complete graph counting method based on a hybrid storage architecture, as provided in an embodiment of this application.

[0023] Figure 3 This is a schematic diagram of the structure of a hybrid storage system for complete graph counting provided in an embodiment of this application;

[0024] Figure 4 This is a schematic diagram of the execution flow of a hybrid storage system for full graph counting provided in an embodiment of this application;

[0025] Figure 5 This is a schematic diagram of the structure of the preprocessing unit provided in the embodiments of this application;

[0026] Figure 6 This is a schematic diagram of the structure of the content-addressable memory provided in the embodiments of this application;

[0027] Figure 7 This is a schematic diagram of the structure of the in-memory computing unit provided in the embodiments of this application;

[0028] Figure 8 This is an example diagram of the graph data corresponding to the object set provided in the embodiments of this application;

[0029] Figure 9 This is an example diagram of a sub-diagram provided in an embodiment of this application;

[0030] Figure 10 This is an example diagram of a storage array for a content-addressable memory provided in an embodiment of this application;

[0031] Figure 11 This is an example diagram of the storage array of the in-memory computing unit provided in the embodiments of this application;

[0032] Figure 12 This is a schematic diagram illustrating the process of obtaining a subset that meets preset conditions, as provided in the embodiments of this application. Detailed Implementation

[0033] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0034] The complete graph counting method based on a hybrid storage architecture provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0035] Figure 1 This is a flowchart illustrating the steps of a full graph counting method based on a hybrid storage architecture provided in an embodiment of this application, as follows: Figure 1 As shown, the method may include:

[0036] Step 101: Obtain a collection of objects, which includes multiple objects, each of which has a pointing relationship with at least one other object.

[0037] In this embodiment of the application, a set of objects is obtained, and then a first set corresponding to the first object in the set of objects is obtained.

[0038] It should be noted that the objects in the object collection can be entity objects, which are naturally existing objects, such as people, animals, food, furniture, buildings, rivers, etc.; the objects in the object collection can also be virtual objects, which are non-natural objects, such as data packets, music, movies, professions, emotions, personalities, etc.

[0039] Each object has a pointing relationship with at least one other object, meaning either each object is pointed to by at least one other object, or each object points to at least one first other object and is pointed to by at least one second other object. Here, the other objects, the first other objects, and the second other objects are all objects in the object set, and the first other object and the second other object are different. For example, if object 1 in the object set points to object 2, then object 1 and object 2 have a pointing relationship.

[0040] Specifically, in some embodiments, when two objects in the object set are related to each other, a pointer relationship is generated between the two objects. The pointer relationship can be that either object points to the other object. The pointer relationship between the two objects is unique and definite. For example, in the object set, if object 1 and object 2 are related to each other, a pointer relationship between object 1 and object 2 or a pointer relationship between object 2 and object 1 is randomly generated. That is, if a pointer relationship between object 1 and object 2 is generated, then there is no pointer relationship between object 2 and object 1; if a pointer relationship between object 2 and object 1 is generated, then there is no pointer relationship between object 1 and object 2.

[0041] For example, if the object set is a user set, and the objects in the object set are users, and the user set includes multiple users, namely user A1, user A2, user A3, user A4, and user A5, and user A1 and user A2 are related (user A1 is the son of user A2, user A2 is the mother of user A1, and the relationship between user A1 and user A2 is a parent-child relationship), then a pointer relationship a1 is generated from user A1 to user A2; if user A1 and user A3 are related (user A1 is the husband of user A3, user A3 is the wife of user A1, and the relationship between user A1 and user A3 is a spouse relationship), then a pointer relationship a2 is generated from user A1 to user A3; if user A4 and user A5 are related (user A4 is the husband of user A5, user A5 is the wife of user A4, and the relationship between user A5 and user A5 is a spouse relationship), then a pointer relationship a3 is generated from user A4 to user A5.

[0042] Step 102: Obtain the first set corresponding to the first object in the object set. The first set includes all the second objects pointed to by the first object.

[0043] In this embodiment of the application, a second set corresponding to a second object is obtained by acquiring a first set corresponding to a first object in an object set, wherein the first set includes all second objects pointed to by the first object.

[0044] Step 103: Obtain the second set corresponding to the second object. The second set includes all objects pointed to by the second object.

[0045] In this embodiment of the application, by obtaining the second set corresponding to the second object, the intersection of the first set and each second set is obtained respectively, and a matrix corresponding to the first object is generated based on all the intersections. The elements in the matrix are used to represent the objects in the intersection.

[0046] Step 104: Obtain the intersection of the first set with each of the second sets, and generate a matrix corresponding to the first object based on all the intersections. The elements in the matrix are used to represent the objects in the intersections.

[0047] In this embodiment of the application, the intersection of the first set and each second set is obtained respectively, and a matrix corresponding to the first object is generated based on all the intersections. Then, based on the matrix corresponding to each of the first objects, the first number of subsets in the object set that satisfy the preset conditions is obtained.

[0048] Step 105: Based on the matrices corresponding to each of the first objects, obtain the first number of subsets in the object set that satisfy a preset condition. The preset condition is that the number of objects in the subset is a preset number, and there is a pointing relationship between any two objects in the subset.

[0049] In this embodiment of the application, the first number of subsets in the object set that satisfy the preset conditions is obtained by using the matrix corresponding to each of the first objects, so as to realize the counting of the number of subsets in a set that satisfy the preset conditions.

[0050] Taking steps 101 to 105 as an example, for instance, the preset quantity in the preset condition is 3, and an object set is obtained. The object set is a user set, and the object in the object set is a user. The user set includes multiple users, namely user B1, user B2, user B3, user B4, user B5, and user B6. Among them, user B1 points to user B2, user B1 points to user B3, user B1 points to user B4, user B2 points to user B3, user B2 points to user B4, user B3 points to user B4, and user B5 points to user B6.

[0051] It should be noted that the presence of a pointing relationship between two users indicates that there is an association between them.

[0052] Get the first set b1 corresponding to user B1 in the user set. The first set b1 includes users B2, B3, and B4 that user B1 points to. Get the first set b2 corresponding to user B2 in the user set. The first set b2 includes users B3 and B4 that user B2 points to. Get the first set b3 corresponding to user B3 in the user set. The first set b3 includes user B4 that user B3 points to. Since user B4 does not point to any other user, the first set b4 corresponding to user B4 is an empty set. Get the first set b5 corresponding to user B5 in the user set. The first set b5 includes user B6 that user B5 points to. Since user B6 does not point to any other user, the first set b6 corresponding to user B6 is an empty set.

[0053] Get the second set c2 corresponding to user B2. The second set c1 includes user B3 and user B4 that user B2 points to. Get the second set c3 corresponding to user B3. The second set c3 includes user B4 that user B3 points to. User B4 does not point to any other user. Therefore, the second set c4 corresponding to user B4 is an empty set. User B6 does not point to any other user. Therefore, the second set c6 corresponding to user B6 is an empty set.

[0054] Find the intersection d1 of the first set b1 and the second set c2, where d1 includes users B3 and B4; find the intersection d2 of the first set b1 and the second set c3, where d2 includes user B4; find the intersection d3 of the first set b1 and the second set c4, where d3 is an empty set; find the intersection d4 of the first set b2 and the second set c3, where d4 includes user B4; find the intersection d5 of the first set b2 and the second set c4, where d5 is an empty set; find the intersection d6 of the first set b3 and the second set c4, where d6 is an empty set; the first set b4 has no corresponding intersection; find the intersection d7 of the first set b5 and the second set c6, where d7 is an empty set; the first set b6 has no corresponding intersection.

[0055] Therefore, the matrix e1 corresponding to user B1 can be:

[0056]

[0057] In this matrix, the elements in the first column of matrix e1 correspond to user B2, the elements in the second column of matrix e1 correspond to user B3, and the elements in the third column of matrix e1 correspond to user B4. The first row of matrix e1 corresponds to the intersection d1, and the elements in the first row of matrix e1 correspond to the elements in the intersection d1. The second row of matrix e1 corresponds to the intersection d2, and the elements in the second row of matrix e1 correspond one-to-one with the elements in the intersection d2. The third row of matrix e1 corresponds to the intersection d3, and the elements in the third row of matrix e1 correspond one-to-one with the elements in the intersection d4. The element "0" in matrix e1 is used to indicate that the intersection corresponding to the row to which element "0" belongs does not contain the user corresponding to element "0". For example, the element "0" in the first row is used to indicate that the intersection d1 does not contain user B2.

[0058] Since the non-zero elements in matrix e1 are users that both users with a pointing relationship point to, the non-zero elements in matrix e1 represent a subset that satisfies a preset condition. For example, the element "user B3" in the first row of matrix e1 is a user that both user B1 and user B2 point to, and user B1 and user B2 have a pointing relationship. Therefore, the element "user B3" in the first row of matrix e1 corresponds to a subset g1 that satisfies a preset condition (subset g1 includes user B1, user B2, and user B3).

[0059] If the number of non-zero elements in matrix e1 is 3, then the number of subsets f1 corresponding to user B1 that satisfy the preset conditions is 3. The subsets corresponding to user B1 that satisfy the preset conditions are subset g1 (subset g1 includes user B1, user B2, and user B3), subset g2 (subset g2 includes user B1, user B2, and user B4), and subset g3 (subset g3 includes user B1, user B3, and user B4).

[0060] Similarly, the matrix e2 corresponding to user B2 can be:

[0061]

[0062] In this matrix, the elements in the first column of matrix e2 all correspond to user B3, and the elements in the second column of matrix e2 all correspond to user B4; the first row of matrix e2 corresponds to the intersection d4, and the elements in the first row of matrix e2 correspond to the elements in the intersection d4; the second row of matrix e2 corresponds to the intersection d5, and the elements in the second row of matrix e2 correspond one-to-one with the elements in the intersection d5; the element "0" in matrix e1 is used to indicate that the intersection corresponding to the row to which element "0" belongs does not contain the user corresponding to element "0".

[0063] If the number of non-zero elements in matrix e1 is 1, then the number of subsets f2 corresponding to user B2 that satisfy the preset conditions is 1, and the subset corresponding to user B2 that satisfies the preset conditions is subset g4 (subset g4 includes user B2, user B3, and user B4).

[0064] Similarly, the matrix e3 corresponding to user B3 can be:

[0065] [0],

[0066] In this matrix, the elements of matrix e3 correspond to user B4; the rows of matrix e3 correspond to the intersection d6, and the elements of the rows of matrix e3 correspond to the elements of the intersection d6; the element "0" of matrix e3 is used to indicate that the intersection of the rows to which element "0" belongs does not contain the user corresponding to element "0".

[0067] If the number of non-zero elements in matrix e3 is 0, then the number of subsets f3 corresponding to user B3 that meet the preset conditions is 0, and user B3 has no corresponding subset that meets the preset conditions.

[0068] Similarly, the matrix e5 corresponding to user B5 can be:

[0069] [0],

[0070] In this matrix, the elements of matrix e5 correspond to user B6; the rows of matrix e5 correspond to the intersection d7, and the elements of the rows of matrix e5 correspond to the elements of the intersection d7; the element "0" of matrix e5 is used to indicate that the intersection of the rows to which element "0" belongs does not contain the user corresponding to element "0".

[0071] If the number of non-zero elements in the count matrix e5 is 0, then the number of subsets f5 corresponding to user B5 that meet the preset conditions is 0, and user B5 has no corresponding subset that meets the preset conditions.

[0072] Since the first set b4 has no corresponding intersection, there is no matrix corresponding to user B4. Similarly, since the first set b6 has no corresponding intersection, there is no matrix corresponding to user B6.

[0073] Summing the quantities f1 (3), f2 (1), f3 (0), and f5 (0), we obtain the first quantity of the subsets in the object set that meet the preset conditions, which is 4 (obtained from 3+1+0+0). That is, the number of user subsets in the user set is 4, where each user subset includes three users, and any two users in the user subset have a relationship.

[0074] Specifically, in some embodiments, a set of objects can be regarded as graph data (a data structure consisting of edges connecting nodes), a subset can be regarded as a subgraph (a part of graph data), and a subset that satisfies preset conditions can be regarded as a complete graph (a subgraph in which any two nodes are connected by an edge).

[0075] In summary, in this embodiment, by obtaining an object set, wherein the object set includes multiple objects, each object having a pointing relationship with at least one other object, then obtaining a first set corresponding to a first object in the object set, wherein the first set includes all second objects pointed to by the first object, then obtaining a second set corresponding to the second object, wherein the second set includes all objects pointed to by the second object, then obtaining the intersection of the first set with each second set, and generating a matrix corresponding to the first object based on all intersections, wherein the elements in the matrix are used to represent the objects in the intersection, and obtaining the first number of subsets in the object set that satisfy a preset condition based on the matrices corresponding to each of the first objects, wherein the preset condition is: the number of objects in the subset is a preset number, and any two objects in the subset have a pointing relationship, thereby realizing the counting of the number of subsets in a set that satisfy the preset condition without the need for manual processing, solving the problem of low work efficiency caused by the manual counting of the number of subsets in a set that satisfy the preset condition in the prior art.

[0076] Figure 2 This is a flowchart illustrating specific steps of a full graph counting method based on a hybrid storage architecture provided in this application embodiment, as follows: Figure 2 As shown, the method may include:

[0077] Step 201: Obtain a set of objects, which includes multiple objects, each of which has a pointing relationship with at least one other object.

[0078] The implementation method of this step is similar to that of sub-step 101 above, and will not be repeated here.

[0079] Step 202: Obtain the first set corresponding to the first object in the object set, wherein the first set includes all the second objects pointed to by the first object.

[0080] The implementation method of this step is similar to that of sub-step 102 above, and will not be repeated here.

[0081] Step 203: Obtain the second set corresponding to the second object, the second set including all objects pointed to by the second object.

[0082] The implementation method of this step is similar to that of sub-step 103 above, and will not be repeated here.

[0083] Step 204: Obtain the intersection of the first set and each of the second sets respectively; the first object has a corresponding matrix, the matrix corresponding to the first object includes multiple rows, the rows correspond one-to-one with the intersection; the elements in the rows correspond one-to-one with the second objects.

[0084] In this embodiment of the application, the intersection of the first set and each second set is obtained respectively, and then the matrix corresponding to the first object is generated based on all the intersections.

[0085] It should be noted that the elements in each row of the matrix are arranged in the same order, that is, in the matrix, elements corresponding to the same second object are in the same column.

[0086] Step 205: If the second object corresponding to an element in the row is the same as any object in the intersection of the row, set the value of the element to a first value; if the second object corresponding to an element in the row is different from all objects in the intersection of the row, set the value of the element to a second value.

[0087] In this embodiment of the application, by setting the value of the element to a first value when the second object corresponding to the element in the row is the same as the object in the intersection of the row, and by setting the value of the element to a second value when the second object corresponding to the element in the row is different from all the objects in the intersection of the row, the matrix corresponding to the first object can be set, that is, the matrix corresponding to the first object can be generated.

[0088] Optionally, in some embodiments, the first value is binary 1 and the second value is binary 0.

[0089] In this embodiment of the application, by setting the value of the element to binary 1 when the second object corresponding to the element in the row is the same as the object in the intersection of the row, and by setting the value of the element to binary 0 when the second object corresponding to the element in the row is different from all the objects in the intersection of the row, the matrix corresponding to the first object can be set, that is, the matrix corresponding to the first object can be generated.

[0090] For example, obtain a set of objects, which is a set of users. The objects in the set of objects are users. The set of users includes multiple users, namely user B1, user B2, user B3, user B4, user B5, and user B6. Among them, user B1 points to user B2, user B1 points to user B3, user B1 points to user B4, user B2 points to user B3, user B2 points to user B4, user B3 points to user B4, and user B5 points to user B6.

[0091] Get the first set b1 corresponding to user B1 in the user set. The first set b1 includes user B2, user B3, and user B4 pointed to by user B1.

[0092] Get the second set c2 corresponding to user B2. The second set c1 includes user B3 and user B4 that user B2 points to. Get the second set c3 corresponding to user B3. The second set c3 includes user B4 that user B3 points to. User B4 does not point to any other user. Therefore, the second set c4 corresponding to user B4 is an empty set.

[0093] Get the intersection d1 of the first set b1 and the second set c2, where the intersection d1 includes user B3 and user B4; get the intersection d2 of the first set b1 and the second set c3, where the intersection d2 includes user B4; get the intersection d3 of the first set b1 and the second set c4, where the intersection d3 is an empty set.

[0094] Therefore, the matrix e1 corresponding to user B1 can be:

[0095]

[0096] In matrix e1, the element "0" indicates that the intersection of the rows to which the element "0" belongs does not contain the user corresponding to the element "0". For example, the first element "0" in the first row indicates that the intersection d1 does not contain user B2. The element "1" in matrix e1 indicates that the intersection of the rows to which the element "1" belongs contains the user corresponding to the element "1". For example, the second element "1" in the first row indicates that the intersection d1 contains user B3.

[0097] Step 206: Based on the matrices corresponding to each of the first objects, obtain the first number of subsets in the object set that satisfy a preset condition. The preset condition is that the number of objects in the subset is a preset number, and there is a pointing relationship between any two objects in the subset.

[0098] The implementation method of this step is similar to that of sub-step 105 above, and will not be repeated here.

[0099] Optionally, in some embodiments, the preset quantity is n, where n is a positive integer greater than 3; step 206 may include the following sub-steps (sub-step 2061, sub-step 2062, sub-step 2063, sub-step 2064, sub-step 2065):

[0100] Sub-step 2061: Obtain all first target elements in each row of the matrix whose values ​​are the first value.

[0101] In this embodiment of the application, all first target elements with values ​​of the first value in each row of the matrix are obtained, and then all first target row matrices corresponding to the first target elements are obtained according to the matrix.

[0102] Sub-step 2062: Based on the matrix, obtain all first target row matrices corresponding to the first target element, wherein the elements of the first target row matrices correspond one-to-one with the second object.

[0103] In this embodiment of the application, by obtaining all first target row matrices corresponding to the first target element according to the matrix, the second number of elements in the first target row matrix with the value of the first value is obtained.

[0104] It should be noted that the elements in each first target row matrix are arranged in the same order as the elements in the rows of the matrix. That is, the second object corresponding to the kth element in the first target row matrix is ​​the same as the second object corresponding to the kth element in the row of the matrix, where k is a positive integer.

[0105] Optionally, in some embodiments, sub-step 2062 may include the following molecular steps (molecular step 2062a, molecular step 2062b):

[0106] Molecular step 2062a: Based on the matrix, obtain multiple row matrices corresponding to the first target element, wherein: based on the matrix, obtain the first row matrix; based on the matrix and the i-th row matrix, obtain the (i+1)-th row matrix, where i is a positive integer less than n-3; the elements of the row matrices correspond one-to-one with the second object;

[0107] In this embodiment of the application, multiple row matrices corresponding to the first target element are obtained based on the matrix, wherein: the first row matrix is ​​obtained based on the matrix, and the (i+1)th row matrix is ​​obtained based on the matrix and the i-th row matrix, and then the (n-3)th row matrix is ​​obtained, and the (n-3)th row matrix is ​​determined as the first target row matrix.

[0108] It should be noted that the elements in each row matrix are arranged in the same order as the elements in the rows of the matrix. That is, the second object corresponding to the k-th element in the row matrix is ​​the same as the second object corresponding to the k-th element in the row of the matrix, where k is a positive integer.

[0109] If all elements in the i-th row matrix are the second value, then there is no first target row matrix, and the step of obtaining the (i+1)-th row matrix based on the matrix and the i-th row matrix is ​​not performed.

[0110] Molecular step 2062b: Determine the (n-3)th row matrix as the first target row matrix.

[0111] In this embodiment of the application, by determining the (n-3)th row matrix as the first target row matrix, the second number of elements in the first target row matrix whose value is the first value is obtained.

[0112] This can be achieved by performing molecular steps 2062a to 2062b, obtaining the first target row matrix, and then obtaining the second number of elements in the first target row matrix whose value is the first value.

[0113] Sub-step 2063: Obtain the second number of elements in the first target row matrix whose value is the first value.

[0114] In this embodiment of the application, the second number of elements in the first target row matrix whose values ​​are the first values ​​is obtained, and then all the second numbers are summed to obtain the third number corresponding to the matrix.

[0115] Sub-step 2064: Summate all the second quantities to obtain the third quantity corresponding to the matrix.

[0116] In this embodiment of the application, the third quantity corresponding to the matrix is ​​obtained by summing all the second quantities, and then the first quantity is obtained by summing all the third quantities.

[0117] Sub-step 2065: Sum all the third quantities to obtain the first quantity.

[0118] In this embodiment of the application, the first quantity is obtained by summing all the third quantities, so as to realize the counting of the number of subsets in a set that meet the preset conditions.

[0119] By executing sub-steps 2061 to 2065, a first quantity can be obtained to count the number of subsets in a set that meet preset conditions.

[0120] Optionally, in some embodiments, obtaining the first row matrix based on the matrix includes the following steps (steps 207 and 208):

[0121] Step 207: Obtain the target second object corresponding to the first target element, and obtain the first target row in the matrix corresponding to the intersection with the target second object.

[0122] In this embodiment of the application, the first target matrix is ​​obtained by obtaining the target second object corresponding to the first target element and obtaining the first target row corresponding to the intersection with the target second object in the matrix, and then obtaining the first row matrix based on the elements in the row to which the first target element belongs and the elements in the first target row.

[0123] Step 208: Obtain the first row matrix based on the elements in the row to which the first target element belongs and the elements in the first target row.

[0124] In this embodiment of the application, a first row matrix is ​​obtained by using the elements in the row to which the first target element belongs and the elements in the first target row, and then a second row matrix is ​​obtained by using the matrix and the first row matrix.

[0125] Optionally, in some embodiments, step 208 includes the following sub-steps (sub-step 2081, sub-step 2082, sub-step 2083):

[0126] Sub-step 2081: In the matrix, if the value of the j-th element of the row to which the first target element belongs is the first value, and the value of the j-th element of the first target row is the first value, then set the value of the j-th element of the first row matrix to the first value; where j is a positive integer, and j is less than or equal to the number of the second objects.

[0127] In this embodiment of the application, by setting the value of the j-th element of the first row matrix to the first value when the value of the j-th element of the row to which the first target element belongs is the first value and the value of the j-th element of the first target row is the first value, the first row matrix is ​​obtained based on the elements in the row to which the first target element belongs and the elements in the first target row.

[0128] Sub-step 2082: In the matrix, if the value of the j-th element of the row to which the first target element belongs is the second value, and the value of the j-th element of the first target row is the second value, then set the value of the j-th element of the first row matrix to the second value.

[0129] In this embodiment of the application, when the value of the j-th element of the row to which the first target element belongs is a second value, and the value of the j-th element of the first target row is a second value, the value of the j-th element of the first row matrix is ​​set to the second value, so as to obtain the first row matrix based on the elements in the row to which the first target element belongs and the elements in the first target row.

[0130] Sub-step 2083: In the matrix, if the value of the j-th element of the row to which the first target element belongs is different from the value of the j-th element of the first target row, the value of the j-th element of the first row matrix is ​​set to the second value.

[0131] In this embodiment of the application, when the value of the j-th element in the row to which the first target element belongs is different from the value of the j-th element in the first target row, the value of the j-th element in the first row matrix is ​​set to a second value, so as to obtain the first row matrix based on the elements in the row to which the first target element belongs and the elements in the first target row.

[0132] This can be achieved by executing sub-steps 2081 to 2083, which obtain the first row matrix based on the elements in the row to which the first target element belongs and the elements in the first target row.

[0133] This can be achieved by executing steps 207 to 208, obtaining the first row matrix, and then obtaining the second row matrix based on the matrix and the first row matrix.

[0134] Optionally, in some embodiments, obtaining the (i+1)th row matrix based on the matrix and the i-th row matrix includes the following steps (steps 209, 210, and 211):

[0135] Step 209: Obtain all second target elements in the i-th row matrix whose values ​​are the first value.

[0136] In this embodiment of the application, the second target row in the matrix is ​​obtained by acquiring all second target elements with the first value in the i-th row matrix, and then by acquiring the second target row in the matrix from the correspondence between the rows and the intersection based on the intersection of the second objects corresponding to the second target elements.

[0137] Step 210: Based on the intersection of the second objects corresponding to the second target element, obtain the second target row in the matrix from the correspondence between the row and the intersection.

[0138] In this embodiment of the application, the second target row in the matrix is ​​obtained from the correspondence between the row and the intersection of the second objects corresponding to the second target element, and then the (i+1)th row matrix is ​​obtained based on the elements of the i-th row matrix and the elements of the second target row.

[0139] Step 211: Obtain the (i+1)th row matrix based on the elements of the i-th row matrix and the elements of the second target row.

[0140] In this embodiment of the application, the (i+1)th row matrix is ​​obtained by using the elements of the i-th row matrix and the elements of the second target row, and then the (n-3)-th row matrix is ​​obtained.

[0141] Optionally, in some embodiments, step 211 includes the following sub-steps (sub-step 2111, sub-step 2112, sub-step 2113):

[0142] Sub-step 2111: If the value of the j-th element of the i-th row matrix is ​​the first value, and the value of the j-th element of the second target row is the first value, then set the value of the j-th element of the (i+1)-th row matrix to the first value; where j is a positive integer, and j is less than or equal to the number of the second objects.

[0143] In this embodiment of the application, when the value of the j-th element of the i-th row matrix is ​​the first value and the value of the j-th element of the second target row is the first value, the value of the j-th element of the (i+1)-th row matrix is ​​set to the first value, so as to obtain the (i+1)-th row matrix based on the elements of the i-th row matrix and the elements of the second target row.

[0144] Sub-step 2112: If the value of the j-th element of the i-th row matrix is ​​the second value, and the value of the j-th element of the second target row is the second value, then set the value of the j-th element of the (i+1)-th row matrix to the second value.

[0145] In this embodiment of the application, when the value of the j-th element of the i-th row matrix is ​​the second value and the value of the j-th element of the second target row is the second value, the value of the j-th element of the (i+1)-th row matrix is ​​set to the second value, so as to obtain the (i+1)-th row matrix based on the elements of the i-th row matrix and the elements of the second target row.

[0146] Sub-step 2113: If the value of the j-th element of the i-th row matrix is ​​different from the value of the j-th element of the first target row, set the value of the j-th element of the (i+1)-th row matrix to the second value.

[0147] In this embodiment of the application, when the value of the j-th element of the i-th row matrix is ​​different from the value of the j-th element of the first target row, the value of the j-th element of the (i+1)-th row matrix is ​​set to a second value, so as to obtain the (i+1)-th row matrix based on the elements of the i-th row matrix and the elements of the second target row.

[0148] This can be achieved by executing sub-steps 2111 to 2113, which obtain the (i+1)th row matrix based on the elements of the i-th row matrix and the elements of the second target row.

[0149] This can be achieved by executing steps 209 to 211, obtaining the (i+1)th row matrix, and then obtaining the (n-3)th matrix.

[0150] Taking steps 201 to 206 as an example, for instance, the preset quantity n in the preset condition is 4, and an object set is obtained. The object set is a user set, and the object in the object set is a user. The user set includes multiple users, namely user B1, user B2, user B3, user B4, user B5, and user B6. Among them, user B1 points to user B2, user B1 points to user B3, user B1 points to user B4, user B2 points to user B3, user B2 points to user B4, user B3 points to user B4, and user B5 points to user B6.

[0151] It should be noted that the presence of a pointing relationship between two users indicates that there is an association between them.

[0152] Get the first set b1 corresponding to user B1 in the user set. The first set b1 includes users B2, B3, and B4 that user B1 points to. Get the first set b2 corresponding to user B2 in the user set. The first set b2 includes users B3 and B4 that user B2 points to. Get the first set b3 corresponding to user B3 in the user set. The first set b3 includes user B4 that user B3 points to. Since user B4 does not point to any other user, the first set b4 corresponding to user B4 is an empty set. Get the first set b5 corresponding to user B5 in the user set. The first set b5 includes user B6 that user B5 points to. Since user B6 does not point to any other user, the first set b6 corresponding to user B6 is an empty set.

[0153] Get the second set c2 corresponding to user B2. The second set c1 includes user B3 and user B4 that user B2 points to. Get the second set c3 corresponding to user B3. The second set c3 includes user B4 that user B3 points to. User B4 does not point to any other user. Therefore, the second set c4 corresponding to user B4 is an empty set. User B6 does not point to any other user. Therefore, the second set c6 corresponding to user B6 is an empty set.

[0154] Find the intersection d1 of the first set b1 and the second set c2, where d1 includes users B3 and B4; find the intersection d2 of the first set b1 and the second set c3, where d2 includes user B4; find the intersection d3 of the first set b1 and the second set c4, where d3 is an empty set; find the intersection d4 of the first set b2 and the second set c3, where d4 includes user B4; find the intersection d5 of the first set b2 and the second set c4, where d5 is an empty set; find the intersection d6 of the first set b3 and the second set c4, where d6 is an empty set; the first set b4 has no corresponding intersection; find the intersection d7 of the first set b5 and the second set c6, where d7 is an empty set; the first set b6 has no corresponding intersection.

[0155] Therefore, the matrix e1 corresponding to user B1 can be:

[0156]

[0157] In this matrix, the elements in the first column of matrix e1 correspond to user B2, the elements in the second column of matrix e1 correspond to user B3, and the elements in the third column of matrix e1 correspond to user B4. The first row of matrix e1 corresponds to the intersection d1, and the elements in the first row of matrix e1 correspond to the elements in the intersection d1. The second row of matrix e1 corresponds to the intersection d2, and the elements in the second row of matrix e1 correspond one-to-one with the elements in the intersection d2. The third row of matrix e1 corresponds to the intersection d3, and the elements in the third row of matrix e1 correspond one-to-one with the elements in the intersection d4. The element "0" in matrix e1 is used to indicate that the intersection corresponding to the row to which element "0" belongs does not contain the user corresponding to element "0". For example, the element "0" in the first row is used to indicate that the intersection d1 does not contain user B2.

[0158] Get all the first target elements with a value of "1" in each row of matrix e1. There are 3 first target elements, namely first target element p1 (the second element in the first row), first target element p2 (the third element in the first row), and first target element p3 (the third element in the second row).

[0159] Since n-3 is 1, the first row matrix is ​​the first target row matrix.

[0160] The first target element p1 is the second element in the first row. The second object corresponding to the second element in the first row is user 3. The intersection of user 3 is the intersection d2 of the first set b1 and the second set c3. The first target row corresponding to the intersection d2 is the second row of matrix e1.

[0161] Since the first element of the first row of matrix e1 (the row containing the first target element p1) is 0, and the first element of the second row of matrix e1 is 0, then the first element of the first row matrix q1 corresponding to the first target element p1 is 0; since the second element of the first row of matrix e1 (the row containing the first target element p1) is 1, and the second element of the second row of matrix e1 is 0, then the second element of the first row matrix q1 corresponding to the first target element p1 is 0; since the third element of the first row of matrix e1 (the row containing the first target element p1) is 1, and the third element of the second row of matrix e1 is 1, then the third element of the first row matrix q1 corresponding to the first target element p1 is 1. Therefore, the first target row matrix h1 corresponding to the first target element p1 is:

[0162] [0 0 1],

[0163] Get the second number r1 (1) of the elements with a value of 1 in the first target row matrix h1.

[0164] Similarly, since the first target element p2 is the third element in the first row, the second object corresponding to the third element in the first row is user 4, and the intersection of user 4 is the intersection d3 of the first set b1 and the second set c4, and the intersection d3 is an empty set, then the first target row matrix h2 corresponding to the first target element p2 is an empty set, and the second number r2 of the elements with a value of 1 in the first target row matrix h2 is 0.

[0165] Since the first target element p3 is the third element in the second row, and the second object corresponding to the third element in the second row is user 4, the intersection of user 4 is the intersection d3 of the first set b1 and the second set c4. Since the intersection d3 is an empty set, the first target row matrix h3 corresponding to the first target element p3 is an empty set, and the second number r3 of the elements with a value of 1 in the first target row matrix h3 is 0.

[0166] Summing the second quantity r1 (1), the second quantity r1 (0), and the second quantity r1 (0) yields the third quantity s1 (1) corresponding to matrix e1. The subset corresponding to matrix e1 that satisfies the preset conditions is subset t1 (subset t1 includes user B1, user B2, user B3, and user B4).

[0167] Similarly, the matrix e2 corresponding to user B2 can be:

[0168]

[0169] In this matrix, the elements in the first column of matrix e2 all correspond to user B3, and the elements in the second column of matrix e2 all correspond to user B4; the first row of matrix e2 corresponds to the intersection d4, and the elements in the first row of matrix e2 correspond to the elements in the intersection d4; the second row of matrix e2 corresponds to the intersection d5, and the elements in the second row of matrix e2 correspond one-to-one with the elements in the intersection d5; the element "0" in matrix e1 is used to indicate that the intersection corresponding to the row to which element "0" belongs does not contain the user corresponding to element "0".

[0170] Get all the first target elements with a value of "1" in each row of matrix e2. There is one first target element, which is p4 (the second element in the first row).

[0171] The first target element p4 is the second element in the first row. The second object corresponding to the second element in the first row is user 4. The intersection of user 4 is the intersection d3 of the first set b1 and the second set c4. Since the intersection d3 is an empty set, the first target row matrix h4 corresponding to the first target element p4 is an empty set. The second number r4 of the first target row matrix h4 with a value of 1 is 0. Therefore, the third number s2 corresponding to matrix e2 is the second number r4 (0).

[0172] The matrix e3 corresponding to user B3 can be:

[0173] [0],

[0174] In this matrix, the elements of matrix e3 correspond to user B4; the rows of matrix e3 correspond to the intersection d6, and the elements of the rows of matrix e3 correspond to the elements of the intersection d6; the element "0" of matrix e3 is used to indicate that the intersection of the rows to which element "0" belongs does not contain the user corresponding to element "0".

[0175] Since the elements in matrix e3 are "0", there is no first target element in matrix e3. Therefore, the third quantity s3 corresponding to matrix e3 is 0.

[0176] Similarly, the third quantity s5 corresponding to matrix e5 is 0.

[0177] Since the first set b4 has no corresponding intersection, there is no matrix corresponding to user B4. Similarly, since the first set b6 has no corresponding intersection, there is no matrix corresponding to user B6.

[0178] Summing the third quantities s1 (1), s2 (0), s3 (0), and s5 (0) yields the first quantity of a subset in the object set that satisfies the preset condition, which is 1 (obtained from 1+0+0+0). That is, the number of user subsets in the user set is 1, where each user subset includes four users, and any two users in the user subset have a relationship.

[0179] Optionally, in some embodiments, the preset quantity is 3; step 206 may include the following sub-steps (sub-step 2066, sub-step 2067):

[0180] Sub-step 2066: Obtain the fourth number of elements in the matrix whose value is the first value.

[0181] In this embodiment of the application, the first quantity is obtained by obtaining the fourth quantity of the elements in the matrix whose value is the first value, and then summing all the fourth quantities.

[0182] Sub-step 2067: Sum all the fourth quantities to obtain the first quantity.

[0183] In this embodiment of the application, the first quantity is obtained by summing all the fourth quantities, so as to realize the counting of the number of subsets in a set that meet the preset conditions.

[0184] This can be achieved by executing sub-steps 2066 and 2067, which allows us to obtain the first number of subsets in the object set that meet the preset conditions.

[0185] For example, sub-steps 2066 and 2067 are described below. For instance, the preset quantity in the preset condition is 3. The object set is obtained. The object set is a user set. The object set contains multiple users, namely user B1, user B2, user B3, user B4, user B5, and user B6. User B1 points to user B2, user B1 points to user B3, user B1 points to user B4, user B2 points to user B3, user B2 points to user B4, user B3 points to user B4, and user B5 points to user B6.

[0186] It should be noted that the presence of a pointing relationship between two users indicates that there is an association between them.

[0187] Get the first set b1 corresponding to user B1 in the user set. The first set b1 includes users B2, B3, and B4 that user B1 points to. Get the first set b2 corresponding to user B2 in the user set. The first set b2 includes users B3 and B4 that user B2 points to. Get the first set b3 corresponding to user B3 in the user set. The first set b3 includes user B4 that user B3 points to. Since user B4 does not point to any other user, the first set b4 corresponding to user B4 is an empty set. Get the first set b5 corresponding to user B5 in the user set. The first set b5 includes user B6 that user B5 points to. Since user B6 does not point to any other user, the first set b6 corresponding to user B6 is an empty set.

[0188] Get the second set c2 corresponding to user B2. The second set c1 includes user B3 and user B4 that user B2 points to. Get the second set c3 corresponding to user B3. The second set c3 includes user B4 that user B3 points to. User B4 does not point to any other user. Therefore, the second set c4 corresponding to user B4 is an empty set. User B6 does not point to any other user. Therefore, the second set c6 corresponding to user B6 is an empty set.

[0189] Find the intersection d1 of the first set b1 and the second set c2, where d1 includes users B3 and B4; find the intersection d2 of the first set b1 and the second set c3, where d2 includes user B4; find the intersection d3 of the first set b1 and the second set c4, where d3 is an empty set; find the intersection d4 of the first set b2 and the second set c3, where d4 includes user B4; find the intersection d5 of the first set b2 and the second set c4, where d5 is an empty set; find the intersection d6 of the first set b3 and the second set c4, where d6 is an empty set; the first set b4 has no corresponding intersection; find the intersection d7 of the first set b5 and the second set c6, where d7 is an empty set; the first set b6 has no corresponding intersection.

[0190] Therefore, the matrix e1 corresponding to user B1 can be:

[0191]

[0192] In this matrix, the elements in the first column of matrix e1 correspond to user B2, the elements in the second column of matrix e1 correspond to user B3, and the elements in the third column of matrix e1 correspond to user B4. The first row of matrix e1 corresponds to the intersection d1, and the elements in the first row of matrix e1 correspond to the elements in the intersection d1. The second row of matrix e1 corresponds to the intersection d2, and the elements in the second row of matrix e1 correspond one-to-one with the elements in the intersection d2. The third row of matrix e1 corresponds to the intersection d3, and the elements in the third row of matrix e1 correspond one-to-one with the elements in the intersection d4. The element "0" in matrix e1 is used to indicate that the intersection corresponding to the row to which element "0" belongs does not contain the user corresponding to element "0". For example, the element "0" in the first row is used to indicate that the intersection d1 does not contain user B2.

[0193] Since the "1" element in matrix e1 represents the user that both users with a pointing relationship point to, the "1" element in matrix e1 represents a subset that satisfies a preset condition. For example, the second element ("1") in the first row of matrix e1 represents user 3 that both user B1 and user B2 point to. Since user B1 and user B2 have a pointing relationship, the second element ("1") in the first row of matrix e1 corresponds to a subset g1 that satisfies a preset condition (subset g1 includes user B1, user B2, and user B3).

[0194] If the number of "1" elements in the count matrix e1 is 3, then the number of subsets f1 corresponding to user B1 that satisfy the preset conditions is 3. The subsets corresponding to user B1 that satisfy the preset conditions are subset g1 (subset g1 includes user B1, user B2, and user B3), subset g2 (subset g2 includes user B1, user B2, and user B4), and subset g3 (subset g3 includes user B1, user B3, and user B4).

[0195] Similarly, the matrix e2 corresponding to user B2 can be:

[0196]

[0197] In this matrix, the elements in the first column of matrix e2 all correspond to user B3, and the elements in the second column of matrix e2 all correspond to user B4; the first row of matrix e2 corresponds to the intersection d4, and the elements in the first row of matrix e2 correspond to the elements in the intersection d4; the second row of matrix e2 corresponds to the intersection d5, and the elements in the second row of matrix e2 correspond one-to-one with the elements in the intersection d5; the element "0" in matrix e1 is used to indicate that the intersection corresponding to the row to which element "0" belongs does not contain the user corresponding to element "0".

[0198] If the number of "1" elements in the count matrix e1 is 1, then the number of subsets f2 corresponding to user B2 that satisfy the preset conditions is 1, and the subset corresponding to user B2 that satisfies the preset conditions is subset g4 (subset g4 includes user B2, user B3, and user B4).

[0199] Similarly, the matrix e3 corresponding to user B3 can be:

[0200] [0],

[0201] In this matrix, the elements of matrix e3 correspond to user B4; the rows of matrix e3 correspond to the intersection d6, and the elements of the rows of matrix e3 correspond to the elements of the intersection d6; the element "0" of matrix e3 is used to indicate that the intersection of the rows to which element "0" belongs does not contain the user corresponding to element "0".

[0202] If the number of "1" elements in the count matrix e3 is 0, then the number of subsets f3 corresponding to user B3 that meet the preset conditions is 0, and user B3 has no corresponding subset that meets the preset conditions.

[0203] Similarly, the matrix e5 corresponding to user B5 can be:

[0204] [0],

[0205] In this matrix, the elements of matrix e5 correspond to user B6; the rows of matrix e5 correspond to the intersection d7, and the elements of the rows of matrix e5 correspond to the elements of the intersection d7; the element "0" of matrix e5 is used to indicate that the intersection of the rows to which element "0" belongs does not contain the user corresponding to element "0".

[0206] If the number of "1" elements in the count matrix e5 is 0, then the number of subsets f5 corresponding to user B5 that meet the preset conditions is 0, and user B5 has no corresponding subset that meets the preset conditions.

[0207] Since the first set b4 has no corresponding intersection, there is no matrix corresponding to user B4. Similarly, since the first set b6 has no corresponding intersection, there is no matrix corresponding to user B6.

[0208] Summing the quantities f1 (3), f2 (1), f3 (0), and f5 (0), we obtain the first quantity of the subsets in the object set that meet the preset conditions, which is 4 (obtained from 3+1+0+0). That is, the number of user subsets in the user set is 4, where each user subset includes three users, and any two users in the user subset have a relationship.

[0209] In summary, in this embodiment, by obtaining an object set, wherein the object set includes multiple objects, each object having a pointing relationship with at least one other object, then obtaining a first set corresponding to a first object in the object set, wherein the first set includes all second objects pointed to by the first object, then obtaining a second set corresponding to the second object, wherein the second set includes all objects pointed to by the second object, then obtaining the intersection of the first set with each second set, and generating a matrix corresponding to the first object based on all intersections, wherein the elements in the matrix are used to represent the objects in the intersection, and obtaining the first number of subsets in the object set that satisfy a preset condition based on the matrices corresponding to each of the first objects, wherein the preset condition is: the number of objects in the subset is a preset number, and any two objects in the subset have a pointing relationship, thereby realizing the counting of the number of subsets in a set that satisfy the preset condition without the need for manual processing, solving the problem of low work efficiency caused by the manual counting of the number of subsets in a set that satisfy the preset condition in the prior art.

[0210] Reference Figure 3 This application also provides a hybrid storage system for complete graph counting. The hybrid storage system for complete graph counting includes: a preprocessing unit 10, a content addressable memory 20, and a storage-computing unit 30. The preprocessing unit 10 is connected to the content addressable memory 20, and the content addressable memory 20 is connected to the storage-computing unit 30.

[0211] The preprocessing unit 10 is used to obtain an object set, the object set including multiple objects, each of the objects having a pointing relationship with at least one other object;

[0212] The content-addressable memory 20 is used to retrieve a first set corresponding to a first object in the object set, the first set including all second objects pointed to by the first object;

[0213] The content addressable memory 20 is also used to retrieve a second set corresponding to the second object, the second set including all objects pointed to by the second object;

[0214] The content-addressable memory 20 is also used to obtain the intersection of the first set and each of the second sets respectively, and generate a matrix corresponding to the first object based on all the intersections, wherein the elements in the matrix are used to represent the objects in the intersections;

[0215] The in-memory computing unit 30 is used to obtain the first number of subsets in the object set that satisfy a preset condition based on the matrix corresponding to each of the first objects. The preset condition is that the number of objects in the subset is a preset number, and there is a pointing relationship between any two objects in the subset.

[0216] It should be noted that the content-addressable memory (CAM) 20 is a content-addressable memory, a special type of RAM array. Its main working mechanism is to automatically and simultaneously compare an input data item with all data items stored in the CAM, determine whether the input data item matches the data items stored in the CAM, and output the matching information corresponding to the data item. The processing-in-memory (PIM) unit 30 is a unit that has the function of embedding computing capabilities into storage resources.

[0217] The CAM provided in this application can be a CAM constructed based on Spin-Transfer Torque Magnetic Random-Access Memory (STT-MRAM), or a CAM constructed based on Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Resistive Random Access Memory (RRAM), etc. The PIM provided in this application can be a PIM constructed based on STT-MRAM, or a PIM constructed based on SRAM, DRAM, RRAM, etc.

[0218] Optional, refer to Figure 4In some embodiments, the execution flow of the hybrid storage system for full graph counting includes: X1, graph orientation, i.e., obtaining an object set through the preprocessing unit 10, wherein the object set includes multiple objects, and each object has a pointing relationship with at least one other object; X2, subgraph induction, i.e., obtaining a first set corresponding to a first object in the object set through the content addressable memory 20, wherein the first set includes all second objects pointed to by the first object, then obtaining a second set corresponding to a second object through the content addressable memory 20, wherein the second set includes all objects pointed to by the second object, then obtaining the intersection of the first set and each second set through the content addressable memory 20 respectively, and generating a matrix corresponding to the first object based on all intersections, wherein the elements in the matrix are used to represent the objects in the intersection; X3, full graph statistics, i.e., obtaining a first number of subsets in the object set that meet preset conditions through the in-memory computing unit 30 based on the matrices corresponding to each of the first objects, wherein the preset conditions are: the number of objects in the subset is a preset number, and any two objects in the subset have a pointing relationship.

[0219] Optional, refer to Figure 5 In some embodiments, the preprocessing unit 10 includes a processor 11, a memory subunit 12, and a first data buffer 13. The processor 11 is connected to the memory subunit 12, the memory subunit 12 is connected to the first data buffer 13, and the first data buffer 13 is connected to the content addressable memory 20. The processor 11 is specifically used to obtain a set of objects and store the set of objects in the memory subunit 12. The first data buffer 13 is used to obtain objects (e.g., object identification values) from the memory subunit 12.

[0220] Optional, refer to Figure 6In some embodiments, the content addressable memory 20 includes a first word line driver 21, a search and write driver 22, an encoder 23, a second data buffer 25, and a plurality of first storage areas 24. The first word line driver 21 is connected to each of the first storage areas 24, the search and write driver 22 is connected to each of the first storage areas 24, the encoder 23 is connected to each of the first storage areas 24, and the second data buffer 25 is connected to the in-memory computing unit 30 and each of the first storage areas 24. The first word line driver 21 is used to control access to each first storage area 24. The search write driver 22 is used to write objects (e.g., object identifier values) to the corresponding first storage area 24 and compare the objects in the first data buffer 13 with the objects in the first storage area 24. Specifically, it performs the following steps: if the second object corresponding to the element in the row is the same as the object in the intersection of the row, the value of the element is set to the first value; or if the second object corresponding to the element in the row is different from all the objects in the intersection of the row, the value of the element is set to the second value. The encoder 23 is used to set the encoding for each first storage area 24. The second data buffer 25 is used to retrieve the objects in each first storage area 24.

[0221] Optional, refer to Figure 7 In some embodiments, the in-memory computing unit 30 includes a bit counter 35 and a plurality of in-memory computing sub-units. The bit counter 35 is connected to each in-memory computing sub-unit. The in-memory computing sub-unit includes a second word line driver 31, a source line bit line driver 32, a sensing amplifier 33, a local data buffer 34, and a plurality of second memory areas 36. The second word line driver 31 is connected to each second memory area 36, ​​the source line bit line driver 32 is connected to each second memory area 36, ​​the sensing amplifier 33 is connected to each second memory area 36, ​​the local data buffer 34 is connected to the sensing amplifier 33, and the local data buffer 34 is connected to the bit counter 35. The second word line driver 31 is used to control access to each second memory area 36, ​​and the source line bit line driver 32 is used to control the voltage difference of the magnetic tunnel junction to realize operations such as reading, writing and logical operations of the second memory area 36 (including storing the value (first value or second value) obtained by comparing the object in the first data buffer 13 with the object in the first memory area 24 into the second memory area 36). The sensing amplifier 33 is used to perform operations on the values ​​(first value or second value) in the two second memory areas 36 to obtain the operation result. The local data buffer 34 is used to obtain the operation result and send it to the bit counter 35. The bit counter 35 is used to sum the operation result to obtain the first number of subsets in the object set that meet the preset conditions.

[0222] By leveraging PIM's parallel processing capabilities, computational speed and energy efficiency have been significantly improved.

[0223] For example, Figure 8 This is the graph data corresponding to the set of objects, which includes object A, object B, object C, object D, object E, object F, object G, object H, and object I. Figure 8 The middle arrow indicates a pointing relationship (e.g., object A points to object B). Since objects B, C, D, and E are objects that object A points to, and the objects pointed to by object A do not include objects F, G, H, and I, we remove objects F, G, H, and I to obtain the subgraph of the first set corresponding to object A (see reference). Figure 9 ).

[0224] Reference Figure 10 In the content-addressable memory 20, each horizontal storage array includes four first storage areas 24, and each vertical storage array includes four first storage areas 24. Horizontal storage array Z1 stores the values ​​of the intersection of the first set corresponding to object A and the second set corresponding to object B (the values ​​include binary 0 and binary 1). Horizontal storage array Z2 stores the values ​​of the intersection of the first set corresponding to object A and the second set corresponding to object C. Horizontal storage array Z3 stores the values ​​of the intersection of the first set corresponding to object A and the second set corresponding to object D. Horizontal storage array Z4 stores the values ​​of the intersection of the first set corresponding to object A and the second set corresponding to object D. The values ​​of the intersection of the first set corresponding to A and the second set corresponding to E are stored in the first storage area 24 of the vertical storage array Y1, which contains the values ​​of the intersection of the first storage area 24 corresponding to object B. The values ​​of the intersection of the first storage area 24 of the vertical storage array Y2, which contains the values ​​of the intersection of the first storage area 24 corresponding to object C, the values ​​of the intersection of the first storage area 24 of the vertical storage array Y3, which contains the values ​​of the intersection of the first storage area 24 corresponding to object D, and the values ​​of the intersection of the first storage area 24 of the vertical storage array Y4 corresponding to object E.

[0225] Reference Figure 11If the preset quantity n is 5, then compared with the number of horizontal storage arrays in the content-addressable memory 20, 2 (n-3) additional horizontal storage arrays are needed for the object set. In the in-memory computing unit 30, each horizontal storage array includes four second storage areas 36, and each vertical storage array includes six second storage areas 36. Horizontal storage array Z5 stores the value of the intersection of the first set corresponding to object A and the second set corresponding to object B (the value types include binary 0 and binary 1). Horizontal storage array Z6 stores the value of the intersection of the first set corresponding to object A and the second set corresponding to object C. Horizontal storage array Z7 stores the value of the intersection of the first set corresponding to object A and the second set corresponding to object C. The horizontal storage array Z8 stores the values ​​of the intersection of the first set corresponding to object A and the second set corresponding to object E; the first storage area 24 in the vertical storage array Y5 stores the values ​​of the intersection of the first storage area 24 corresponding to object B; the first storage area 24 in the vertical storage array Y6 stores the values ​​of the intersection of the first storage area 24 corresponding to object C; the first storage area 24 in the vertical storage array Y7 stores the values ​​of the intersection of the first storage area 24 corresponding to object D; and the first storage area 24 in the vertical storage array Y8 stores the values ​​of the intersection of the first storage area 24 corresponding to object E.

[0226] Horizontal storage array Z9 stores the first row matrix, which is obtained by combining the elements of the first and second rows of the matrix. Horizontal storage array Z10 stores the second row matrix, which is obtained by combining the elements of the first row matrix and the elements of the third row. This second row matrix is ​​determined as the first target row matrix. Since the only "1" element in the first target row matrix is ​​its fourth element, the number of "1" elements in the first target row matrix is ​​one. The second object corresponding to the fourth element of the first target row matrix is ​​object E, which is pointed to by objects B, C, and D. (Refer to...) Figure 12 First, obtain object B that object A points to. Then, obtain object C that both object A and object B point to. Finally, obtain object E that objects B, C, and D all point to. Then, we have obtained a subset that satisfies the preset conditions. The subset that satisfies the preset conditions includes object B, object C, object D, and object E.

[0227] The specific implementation process of the hybrid storage system for full graph counting is similar to that of the aforementioned full graph counting method based on hybrid storage architecture, and will not be repeated here.

[0228] In summary, in this embodiment, the preprocessing unit 10 obtains an object set, which includes multiple objects, each of which has a pointing relationship with at least one other object. Then, the content-addressable memory 20 obtains a first set corresponding to a first object in the object set, where the first set includes all second objects pointed to by the first object. Next, the content-addressable memory 20 obtains a second set corresponding to a second object, where the second set includes all objects pointed to by the second object. Finally, the content-addressable memory 20 obtains the intersection of the first set with each second set, and based on all intersections, generates a set corresponding to the first object. The matrix is ​​used to represent the objects in the intersection. The storage and computing unit 30 obtains the first number of subsets in the object set that meet the preset conditions based on the matrix corresponding to each of the first objects. The preset conditions are: the number of objects in the subset is a preset number, and there is a pointing relationship between any two objects in the subset. This realizes the counting of the number of subsets in a set that meet the preset conditions without the need for manual processing. This solves the problem of low work efficiency caused by the manual counting of the number of subsets in a set that meet the preset conditions in the prior art.

[0229] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0230] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0231] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A complete graph counting method based on a hybrid storage architecture, characterized in that, The method includes: Obtain a collection of objects, the collection of objects including multiple objects, each of which has a pointing relationship with at least one other object; the objects are entity objects or virtual objects. Obtain the first set corresponding to the first object in the object set, wherein the first set includes all the second objects pointed to by the first object; Obtain the second set corresponding to the second object, the second set including all objects pointed to by the second object; Obtain the intersection of the first set with each of the second sets, and generate a matrix corresponding to the first object based on all the intersections. The elements in the matrix are used to represent the objects in the intersections. Based on the matrices corresponding to each of the first objects, obtain the first number of subsets in the object set that satisfy a preset condition, wherein the preset condition is: the number of objects in the subset is a preset number, and there is a pointing relationship between any two objects in the subset; The matrix comprises multiple rows, each row corresponding one-to-one with the intersection; each element in a row corresponds one-to-one with the second object; generating the matrix corresponding to the first object based on all the intersections includes: If the second object corresponding to an element in the row is the same as an object in the intersection of the rows, the value of the element is set to the first value. If the second object corresponding to an element in the row is different from all objects in the intersection of the row, the value of the element is set to the second value. The preset quantity is n, where n is a positive integer greater than 3; the step of obtaining the first quantity of a subset of the object set that satisfies the preset condition based on the matrix corresponding to each of the first objects includes: Obtain all first target elements in each row of the matrix whose values ​​are the first value; Based on the matrix, obtain all first target row matrices corresponding to the first target element, and the elements of the first target row matrices correspond one-to-one with the second object; Obtain the second number of elements in the first target row matrix that have the first value; Summing up all the second quantities yields the third quantity corresponding to the matrix; Summing up all the third quantities yields the first quantity.

2. The method according to claim 1, characterized in that, The step of obtaining all first target row matrices corresponding to the first target element based on the matrix includes: Based on the matrix, obtain multiple row matrices corresponding to the first target element, wherein: based on the matrix, obtain the first row matrix; based on the matrix and the i-th row matrix, obtain the (i+1)-th row matrix, where i is a positive integer less than n-3; the elements of the row matrices correspond one-to-one with the second object; The (n-3)th row matrix is ​​determined as the first target row matrix.

3. The method according to claim 2, characterized in that, Obtaining the first row matrix based on the matrix includes: Obtain the target second object corresponding to the first target element, and obtain the first target row in the matrix corresponding to the intersection with the target second object; The first row matrix is ​​obtained based on the elements in the row to which the first target element belongs and the elements in the first target row.

4. The method according to claim 3, characterized in that, The step of obtaining the first row matrix based on the elements in the row to which the first target element belongs and the elements in the first target row includes: In the matrix, if the value of the j-th element in the row to which the first target element belongs is the first value, and the value of the j-th element in the first target row is the first value, then the value of the j-th element in the first row matrix is ​​set to the first value; where j is a positive integer, and j is less than or equal to the number of the second objects; In the matrix, if the value of the j-th element in the row to which the first target element belongs is the second value, and the value of the j-th element in the first target row is the second value, then the value of the j-th element in the first row matrix is ​​set to the second value. In the matrix, if the value of the j-th element in the row to which the first target element belongs is different from the value of the j-th element in the first target row, the value of the j-th element in the first row matrix is ​​set to the second value.

5. The method according to claim 2, characterized in that, The step of obtaining the (i+1)th row matrix based on the matrix and the i-th row matrix includes: Obtain all second target elements in the i-th row matrix whose values ​​are the first value; Based on the intersection of the second objects corresponding to the second target element, the second target row in the matrix is ​​obtained from the correspondence between the row and the intersection; The (i+1)th row matrix is ​​obtained based on the elements of the i-th row matrix and the elements of the second target row.

6. The method according to claim 5, characterized in that, The step of obtaining the (i+1)th row matrix based on the elements of the i-th row matrix and the elements of the second target row includes: If the value of the j-th element of the i-th row matrix is ​​the first value, and the value of the j-th element of the second target row is the first value, then the value of the j-th element of the (i+1)-th row matrix is ​​set to the first value; where j is a positive integer, and j is less than or equal to the number of the second objects; If the value of the j-th element of the i-th row matrix is ​​the second value, and the value of the j-th element of the second target row is the second value, then the value of the j-th element of the (i+1)-th row matrix is ​​set to the second value. If the value of the j-th element of the i-th row matrix is ​​different from the value of the j-th element of the first target row, the value of the j-th element of the (i+1)-th row matrix is ​​set to the second value.

7. The method according to claim 1, characterized in that, The preset quantity is 3; The step of obtaining the first number of subsets in the object set that satisfy preset conditions based on the matrices corresponding to each of the first objects includes: Obtain the fourth number of elements in the matrix that have the first value; Summing up all the fourth quantities yields the first quantity.

8. A hybrid storage system for complete graph counting, characterized in that, include: The system includes a preprocessing unit, a content-addressable memory, and a storage-computing unit, wherein the preprocessing unit is connected to the content-addressable memory, and the content-addressable memory is connected to the storage-computing unit. The preprocessing unit is used to obtain a set of objects, which includes multiple objects, and each object has a pointing relationship with at least one other object; the objects are entity objects or virtual objects. The content-addressable memory is used to retrieve a first set corresponding to a first object in the object set, the first set including all second objects pointed to by the first object; The content-addressable memory is also used to retrieve a second set corresponding to the second object, the second set including all objects pointed to by the second object; The content-addressable memory is also used to obtain the intersection of the first set and each of the second sets respectively, and generate a matrix corresponding to the first object based on all the intersections, wherein the elements in the matrix are used to represent the objects in the intersections; The in-memory computing unit is used to obtain the first number of subsets in the object set that satisfy a preset condition based on the matrix corresponding to each of the first objects. The preset condition is that the number of objects in the subset is a preset number, and there is a pointing relationship between any two objects in the subset. The matrix comprises multiple rows, and each row corresponds one-to-one with the intersection. The elements in the row correspond one-to-one with the second object; generating the matrix corresponding to the first object based on all the intersections includes: If the second object corresponding to an element in the row is the same as an object in the intersection of the rows, the value of the element is set to the first value. If the second object corresponding to an element in the row is different from all objects in the intersection of the row, the value of the element is set to the second value. The preset quantity is n, where n is a positive integer greater than 3; the step of obtaining the first quantity of a subset of the object set that satisfies the preset condition based on the matrix corresponding to each of the first objects includes: Obtain all first target elements in each row of the matrix whose values ​​are the first value; Based on the matrix, obtain all first target row matrices corresponding to the first target element, and the elements of the first target row matrices correspond one-to-one with the second object; Obtain the second number of elements in the first target row matrix that have the first value; Summing up all the second quantities yields the third quantity corresponding to the matrix; Summing up all the third quantities yields the first quantity.

Citation Information

Patent Citations

  • Method and system for acquiring correlation degree in graph structure

    CN118113912A