A graph classification method based on k-truss and graph kernel and its application
Through k-truss decomposition and truss variant graph kernel functions, the problem that existing technology is difficult to reveal graph structures at different scales is solved, the performance of graph classification is improved, the ability to express complex substructures is enhanced, and graph classification is improved Effect.
Patent Information
- Application Number
- CN202210362761.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-07
- Publication Date
- 2024-10-29
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing graph kernel methods are difficult to reveal graph structures at different scales, resulting in insufficient ability to express complex substructures in graph classification tasks, affecting performance.
The k-truss-based decomposition method is used to construct the hierarchical structure of nested subgraphs and generate graph kernel functions in the form of truss variants, which are used to compare graph structures and improve graph classification performance.
Through k-truss decomposition and truss variant graph kernel functions, the performance of graph classification is improved, graph structures can be compared at multiple different scales, the ability to express complex substructures is enhanced, and the effect of graph classification tasks is improved.
Smart Images

Figure CN114817418B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data analysis and mining, and in particular to a graph classification method based on k-truss and graph kernel and application thereof. Background Art
[0002] Graphs are a form of structured data that can model complex relationships between objects. In recent years, more and more data has been modeled as graphs, and such data is ubiquitous in social networks, biology, chemistry, and other fields. For example, in biochemistry, molecular compounds can be modeled as graphs, with vertices corresponding to atoms and edges corresponding to chemical bonds. As the demand for structured data analysis grows, graph classification problems have been widely studied in these fields.
[0003] Kernel methods are by far one of the most popular approaches for comparing similarities between structured objects, especially in the field of graph classification. In general, kernel methods use a positive semi-finite kernel function to measure the similarity between two objects, which can be expressed as a certain inner product in the reproducing kernel Hilbert space H. Existing graph kernels are calculated based on local properties, such as neighborhood features of vertices, or some small substructures of the graph (i.e., trees, cycles, small graphs), and some are built from a global perspective, focusing more on the global properties of the graph. Therefore, it is a challenge to find a graph kernel that can reveal graph structures at different scales. Summary of the invention
[0004] To solve the above technical problems, the present invention provides a graph classification method based on k-truss and graph kernel, which utilizes graph k-truss decomposition to establish a hierarchical structure of nested subgraphs, and can compare graph structures at multiple different scales. This can improve the basic graph kernel, generate a graph kernel function in the form of a truss variant, improve the basic graph kernel's ability to express complex substructures, and improve the performance of the basic graph kernel in graph classification tasks.
[0005] To achieve the above object, the technical solution of the present invention is as follows:
[0006] A graph classification method based on k-truss and graph kernel, characterized by comprising the following steps:
[0007] Step 1: Obtain the graph data that needs to be classified. Each sample of the graph classification data has its category label.
[0008] Step 2: Use the k-truss decomposition of the graph to build a hierarchical structure of nested subgraphs for each sample;
[0009] Step 3: Use the graph kernel function in the form of a truss variant to measure the similarity between each two graphs, generate a kernel matrix, and use the graph category label information to train the C-Support Vector Machine (SVM) classifier;
[0010] Step 4: Input the graph data to be classified into the trained classifier to obtain the classification result.
[0011] Furthermore, in step 2, the decomposition method is specifically as follows:
[0012] (1) We already know that the 2-truss is the entire graph, so we initialize k=3.
[0013] (2) Calculate the support value of all edges, that is, the number of triangles containing the edge;
[0014] (3) Sort the edges according to their support values from small to large;
[0015] (4) Find an edge e with u and v as endpoints. Assume that the degree of u is less than or equal to the degree of v and its support value is less than k-2. Then for each neighbor w of u, if there is an edge between w and v, that is, u, v, w form a triangle, then reduce the support values of both sides (u, w) and (v, w) by 1.
[0016] (5) Delete edge e from G and update the order of the remaining edges, maintaining the order of the edge support values from small to large;
[0017] (6) Repeat (4) and (5) until no edge is found that satisfies the support value less than k-2, then output the current G as a k-truss; if G is not empty at this time, increase k by 1 and repeat steps (4)-(6); if G is empty at this time, the decomposition process ends.
[0018] Furthermore, the hierarchical structure of the nested subgraphs obtained after the decomposition process is represented as follows:
[0019]
[0020] Among them, ω * (G) is represented by the maximum value of all edge truss values in the graph, which is used to measure the density of the graph.
[0021] Furthermore, the specific method of step three is as follows:
[0022] (1) The kernel function between two graphs is defined as:
[0023] k(G,G′)=<φ(G),φ(G′)>;
[0024] (2) Select a kernel as the basic kernel for the image classification task;
[0025] (3) Apply the kernel function of the basic graph kernel to the hierarchical structure of the nested subgraphs obtained in step 2, expand the single kernel function into the sum of a set of kernel functions, and generate a truss variant form of the graph kernel. The truss variant form k of the basic graph kernel k is t Defined as:
[0026]
[0027] in, and Represent the 2-truss, 3-truss, ..., Subgraph, represents the maximum value of all edge truss values in the two graphs (ω * (G) value) the smaller value;
[0028] (4) The graph kernel function in this truss variant form is used to obtain the kernel matrix used to describe the similarity between every two graphs in the graph data, and the graph category label information is used to train the C-support vector machine classifier.
[0029] Furthermore, the kernel is selected from any one of an R-convolution kernel, an intersection kernel, and a distribution kernel.
[0030] The present invention also provides a use of the graph classification method based on k-truss and graph kernel, which can be used for the classification of biological enzymes.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] (1) The present invention constructs a hierarchy of nested subgraphs through k-truss decomposition, which allows graphs to be compared at multiple different scales.
[0033] (2) The present invention proposes a new graph kernel improvement method, which enhances the basic graph kernel's ability to express complex substructures. In particular, the truss variant graph kernel function generated by this method improves the performance of the basic graph kernel in graph classification tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A schematic flow chart of a graph classification method based on k-truss and graph kernel disclosed in an embodiment of the present invention;
[0035] Figure 2 It is a flow chart of the k-truss decomposition stage of Figure G;
[0036] Figure 3 A schematic diagram of the specific process of calculating the kernel function value of the truss variant.
[0037] Figure 4 Given graphs G and G', the calculation process of the basic graph kernel Weisfeiler-Lehman subtree kernel (WL) when the iteration number h = 1;
[0038] Figure 5 Model the three-dimensional structure of the enzyme as a schematic diagram;
[0039] Figure 6 Schematic diagram of the decomposition process of all k-truss subgraphs in Figure G. DETAILED DESCRIPTION
[0040] In order to facilitate the understanding of the present invention, the present invention is described in more detail below in conjunction with the accompanying drawings and specific embodiments. Preferred embodiments of the present invention are provided in the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described in this specification. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.
[0041] Embodiment 1 Embodiment 1 provides a graph classification method based on k-truss and graph kernel, the process is as follows Figure 1 As shown, the specific steps include:
[0042] Step 1: Obtain the graph data that needs to be classified. Each sample of the graph classification data has its category label.
[0043] Step 2: Use the k-truss decomposition of the graph to build a hierarchical structure of nested subgraphs for each sample; in a further technical solution, the decomposition method is as follows: Figure 2 As shown, the details are as follows:
[0044] (1) We already know that the 2-truss is the entire graph, so we initialize k=3.
[0045] (2) Calculate the support value of all edges, that is, the number of triangles containing the edge;
[0046] (3) Sort the edges according to their support values from small to large;
[0047] (4) Find an edge e with u and v as endpoints. Assume that the degree of u is less than or equal to the degree of v and its support value is less than k-2. Then for each neighbor w of u, if there is an edge between w and v, that is, u, v, w form a triangle), reduce the support values of both sides (u, w) and (v, w) by 1.
[0048] (5) Delete edge e from G and update the order of the remaining edges, maintaining the order of the edge support values from small to large;
[0049] (6) Repeat (4) and (5) until no edge is found that satisfies the support value less than k-2. Then output the current G as the k-truss subgraph of the original graph G, denoted by T k ; If G is not empty at this time, k increases by 1 and steps (4)-(6) are repeated; If G is empty at this time, the decomposition process ends.
[0050] The maximum value of all the truss values of the graph is recorded as ω * (G), the result of truss decomposition forms a nested "chain":
[0051]
[0052] Obviously, the edges in graph G that belong to the (k+1)-truss must belong to the k-truss.
[0053] Step 3: Use the truss variant form of the graph kernel function to measure the similarity between each two graphs, generate a kernel matrix, and use the graph category label information to train the C-Support Vector Machine (SVM) classifier. The specific method is as follows:
[0054] Many graph kernels, i.e., kernel functions between graphs, have been proposed in existing literature to solve the problem of similarity evaluation between graphs, such as: R-convolutional graph kernel, intersection graph kernel and distribution graph kernel. R-convolutional graph kernel includes small graph kernel (GR), Weisfeiler-Lehman subtree kernel (WL), shortest path kernel (SP), etc. Intersection graph kernel includes neighborhood hash kernel (NH), etc. Distribution graph kernel includes pyramid matching graph kernel (PM), etc. Graph kernel implicitly embeds the graph into Hilbert space, and calculates the inner product between these vector representations to express the similarity, and represents it with the kernel function value. In the method of the present invention, any one of the above graph kernels can be selected to solve the graph classification task.
[0055] 1. In this embodiment, the Weisfeiler-Lehman subtree kernel is selected as the basic graph kernel for the graph classification task;
[0056] The basic idea of Weisfeiler-Lehman subtree kernel (WL) is to extract sub-parts of the graph structure, measure the similarity of two graphs by comparing the structural similarity of the sub-parts, and use the similarity as the core value of the graph kernel. Weisfeiler-Lehman subtree kernel (WL) is based on the one-dimensional WL graph matching algorithm. The key idea of the algorithm is to expand the node labels by sorting the node labels of adjacent nodes and compressing these expanded labels into new short labels. The specific process is as follows:
[0057] (1) Given two graphs G and G', such as Figure 4As shown in a. Aggregate the labels of each node and its neighbor nodes in the two graphs. The label of the current node and its neighbor node labels are separated by commas. The neighbor node labels are arranged in ascending order, as shown in Figure 4 As shown in b;
[0058] (2) Use the hash function defined on the multiset to calculate based on the result in (1) to obtain a new label for each node, and assign the new label to the corresponding node, such as Figure 4 As shown in c;
[0059] (3) In the iterative process (1) and (2), if two graphs G and G' are isomorphic, then after a certain iteration, the labels of the corresponding nodes of the two graphs will become exactly the same. Figure 4 As shown in (d), G and G' have different labels on the corresponding nodes, so they are not structurally identical.
[0060] Let G and G' be two graphs, and Σ[i] be the set of labels that appear in the two graphs at the end of the i-th iteration of the WL algorithm. In particular, Σ[0] is the original label set. In each iteration, the labels of a node and its neighbors are merged into a multi-label set and given a new label. Then the Weisfeiler-Lehman subtree kernel is defined as
[0061] k WL (G, G′)=<φ(G),φ(G′)>
[0062] Among them, φ(G) is a vector consisting of h+1 blocks. As a feature vector (structural information) of graph G, it is represented as block 0 to block h. The i-th element in the j-th block reflects the frequency of occurrence of the i-th label in the j-th iteration. The calculation process is as follows Figure 4 As shown in figure e.
[0063] 2. Apply the kernel function of the basic graph kernel to the hierarchical structure of the nested subgraphs obtained in step 2, expand the single kernel function into the sum of a set of kernel functions, and generate a truss variant form of the graph kernel function. The truss variant form k of the basic graph kernel k is t Defined as:
[0064]
[0065] in, and Represent the 2-truss, 3-truss, ..., Subgraph, represents the maximum value of all edge truss values in the two graphs (ω * (G) value).
[0066] Figure 3 The process of calculating the value of the graph kernel function in the form of a truss variant is described. The specific steps are as follows:
[0067] (1) Initialize the variant kernel function value to val;
[0068] (2) Obtain two graphs ω * (G) Smaller value
[0069] (3) For i from 2 to Sequentially add the kernel function values of the base graph kernel k on the i-truss subgraphs of the two graphs to val;
[0070] (4) Return val as the final variant kernel function value.
[0071] 3. Construct an SVM classifier based on the graph kernel function in the form of a truss variant to perform graph classification tasks. The specific method is as follows:
[0072] (1) This truss variant form of the graph kernel function is used to obtain the kernel matrix K used to describe the similarity between each two graphs in the graph data. The element K of the kernel matrix K is ij Calculated as:
[0073] K ij =K ji = k(G i ,G j ).
[0074] (2) Using the graph category label information, train the C-Support Vector Machine (SVM) classifier and perform 10-fold cross validation. SVM cross-validates the pre-calculated kernel matrix list and uses Grid Search to find the optimal SVM parameter C and the hyperparameters of the basic graph kernel;
[0075] (3) Save the trained SVM model. The trained classifier model can be used to predict the type of graph.
[0076] Embodiment 2 This embodiment provides an application example of the graph classification method based on k-truss and graph kernel of the present invention in biological enzyme classification. The specific steps and process are as follows:
[0077] 1. Download the three-dimensional structures of six enzymes from the PDB biological macromolecular structure database, namely oxidoreductases, transferases, hydrolases, lyases, isomerases and ligases.
[0078] 2. The three-dimensional structures of the six types of enzymes obtained are modeled as graphs. The modeling process is as follows: Figure 5As shown in , the vertices of the graph are the secondary structures of the protein. If two vertex elements are adjacent in the amino acid sequence or three-dimensional space, there is an edge between them; Figure 5 The middle circle shows the secondary structure of the protein. The collection of these figures constitutes the enzyme data set. In this embodiment, the number of data sets should be no less than 6*100, divided into 6 groups, each group has no less than 100, corresponding to six types of enzymes.
[0079] These images are used as sample images and are processed as follows:
[0080] 1. Given a sample graph G, the k-truss of G is the largest subgraph of G, where each edge is contained in at least (k-2) triangles of the subgraph.
[0081] 2. Decompose all k-truss subgraphs in graph G and establish a hierarchical structure of nested subgraphs; the decomposition process is as follows Figure 2 The typical decomposition process is shown in Figure 6 As shown; for specific steps, refer to step 2 in embodiment 1;
[0082] 3. Improve the basic graph kernel and generate a truss variant graph kernel; for specific methods and steps, see steps 1 and 2 in Example 1;
[0083] 4. Apply the truss variant graph kernel to extract the substructure of the sample graph, and measure the similarity of the two sample graphs by comparing the similarity of the substructures, so as to obtain the kernel function value between each sample graph. In this embodiment, the vertices of the sample graph are protein secondary structure elements. There is an edge between any two adjacent vertex elements in the amino acid sequence or three-dimensional space. The vertex has a type label (node_label), indicating that the secondary structure represented by the vertex is a spiral, sheet or turn. Each sample graph corresponds to a type label of an enzyme;
[0084] 5. The kernel matrix K is formed by the kernel function values between the sample graphs. The element K of the kernel matrix K is ij Calculated as:
[0085] K ij =K ji = k(G i , G j ).
[0086] 6. The sample graph is used to train the C-SVM classifier, and a 10-fold cross validation is performed. The trained classifier can be used to predict the type of enzyme.
[0087] 3. Model the three-dimensional structure of the enzyme to be tested as a graph. The modeling process is as follows: Figure 5As shown, the constructed graph is input into the trained SVM classifier, and after prediction, the type label corresponding to the enzyme is output.
[0088] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined in the present invention may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown in the present invention, but will conform to the widest scope consistent with the principles and novel features disclosed in the present invention.
Claims
1. A graph classification method based on k-truss and graph kernel, characterized in that: The steps include: Step 1: Download the three-dimensional structures of six types of biological enzymes from the PDB biological macromolecular structure database, which are oxidoreductases, transferases, hydrolases, lyases, isomerases and ligases; model the three-dimensional structures of the six types of enzymes obtained as graphs, where the vertices of the graphs are the secondary structures of proteins. If two vertex elements are adjacent in the amino acid sequence or three-dimensional space, there is an edge between them; the collection of these graphs constitutes the enzyme data set; obtain the graph data to be classified, and each sample of the graph classification data has its category label; given a sample graph G, the k-truss of G is the largest subgraph of G, in which each edge is contained in at least k-2 triangles of the subgraph; Step 2: Use the k-truss decomposition of the graph to build a hierarchical structure of nested subgraphs for each sample; specifically: (1) We already know that the 2-truss is the entire graph, so we initialize k=3; (2) Calculate the support value of all edges, that is, the number of triangles containing the edge; (3) Sort the edges according to their support values from small to large; (4) Find an edge e with u and v as endpoints. Assume that the degree of u is less than or equal to the degree of v and its support value is less than k-2. Then for each neighbor w of u, if there is an edge between w and v, that is, u, v, w form a triangle, then reduce the support values of both sides (u, w) and (v, w) by 1. (5) Delete edge e from G and update the order of the remaining edges, maintaining the order of the edge support values from small to large; (6) Repeat (4) and (5) until no edge with a support value less than k-2 is found, then output the current G as a k-truss; if G is not empty at this time, increase k by 1 and repeat steps (4)-(6); If G is empty at this time, the decomposition process ends; Step 3: Use the graph kernel function in the form of a truss variant to measure the similarity between each two graphs, generate a kernel matrix, and use the graph category label information to train the C-SVM classifier; Step 4: Input the graph data to be classified into the trained classifier to obtain the classification result.
2. The graph classification method based on k-truss and graph kernel according to claim 1, characterized in that: In step 2, the hierarchical structure of the nested subgraph obtained after the decomposition process is completed is expressed as follows: Among them, ω * (G) is represented by the maximum value of all edge truss values in the graph, which is used to measure the density of the graph.
3. The graph classification method based on k-truss and graph kernel according to claim 1, characterized in that: In the step 3, the specific method is as follows: (1) The kernel function between two graphs is defined as: k(G,G′)=<φ(G),φ(G′)>; (2) Select a kernel as the basic kernel for the image classification task; (3) Apply the kernel function of the basic graph kernel to the hierarchical structure of the nested subgraphs obtained in step 2, expand the single kernel function into the sum of a set of kernel functions, and generate a truss variant form of the graph kernel. The truss variant form k of the basic graph kernel k is t Defined as: in, and Represents graph G and graph G′ respectively Subgraph, represents the maximum value of all edge truss values in the two graphs (ω * (G) value) is the smaller value; (4) The graph kernel function in this truss variant form is used to obtain the kernel matrix used to describe the similarity between every two graphs in the graph data, and the graph category label information is used to train the C-support vector machine classifier.
4. The graph classification method based on k-truss and graph kernel according to claim 3, characterized in that: The kernel is selected from any one of an R-convolution kernel, an intersection kernel, and a distribution kernel.
Citation Information
Patent Citations
Numa-perceived community discovery method based on k-trus decomposition
CN114265691A
Tessellation and Connection System for Space Assembly of Modular Units
US20220100930A1
