Digraph similarity calculation method and system based on digraph matching network

By combining DiGIN and LR-NTN, the problem of insufficient capture of directional information in directed graph similarity calculation is solved, achieving efficient and accurate graph similarity prediction, which is applicable to large-scale directed graph data.

CN121859012APending Publication Date: 2026-04-14NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-22
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively capture the asymmetric structure and directional information of directed graphs, resulting in insufficient accuracy in graph similarity calculations. Furthermore, traditional methods have high computational complexity with large-scale graph data, making them difficult to apply in real-world scenarios.

Method used

The system employs a directed graph isomorphic network (DiGIN) for encoding, combines dual-view graph pooling and low-rank neural network tensor network (LR-NTN) for graph matching, generates directional semantic embeddings of nodes and edges, and calculates graph similarity through low-rank projection and core tensor interaction.

Benefits of technology

It achieves efficient and accurate similarity prediction for directed graphs, improves computational efficiency and model scalability, and significantly enhances the computational performance and robustness of large-scale directed graph data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121859012A_ABST
    Figure CN121859012A_ABST
Patent Text Reader

Abstract

The invention discloses a directed graph similarity calculation method and system based on a directed graph matching network. The method comprises the following steps: carrying out directed graph coding on an input directed graph; performing double-view image pooling on the coded directed graph to extract comprehensive graph-level representation containing directional semantics from two levels of nodes and edges; performing low-rank neural network tensor network matching on the graph-level representations from the two directed graphs, and predicting a similarity score between the directed graphs; model parameters are trained and optimized by minimizing an error between a predicted similarity and a real similarity. According to the method, the similarity between the directed graphs can be efficiently and accurately calculated, the problems that directional modeling is insufficient, graph-level representation lacks semantics and matching efficiency and precision are difficult to consider when an existing method is used for processing the directed graphs are effectively solved, and the accuracy and expandability of similarity calculation of the directed graphs are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence, graph neural networks and graph data analysis, and in particular to a method and system for calculating the similarity of directed graphs based on directed graph matching networks. Background Technology

[0002] In the real world, many complex data structures can be naturally modeled as graphs, such as social networks, protein-protein interaction networks, molecular structures, program control flow graphs, and knowledge graphs. Graph similarity calculation is one of the core problems in the field of graph analysis.

[0003] It has wide applications in various fields such as pattern recognition, anomaly detection, bioinformatics, drug discovery, and code similarity detection. By accurately calculating the similarity between graphs, advanced tasks such as graph classification, graph clustering, and graph retrieval can be achieved.

[0004] Traditional graph similarity calculation methods primarily rely on Graph Edit Distance (GED). GED is defined as the minimum cost required to transform one graph into another through a series of atomic operations (such as node / edge insertion, deletion, and relabeling). While GED provides an accurate similarity measure, its computation is an NP-complete problem, resulting in extremely high computational complexity for large-scale graphs, making it difficult to apply in real-world scenarios. Therefore, researchers have proposed many approximation algorithms for GED, but these algorithms typically involve a trade-off between computational efficiency and similarity accuracy and are difficult to directly apply to deep learning models.

[0005] In recent years, with the rapid development of deep learning and graph neural networks (GNNs), end-to-end learning of graph similarity has become possible. By learning low-dimensional vector representations of graphs (i.e., graph embeddings) through GNNs and then using these embeddings to compute similarity, the computational bottleneck of GED can be effectively avoided.

[0006] However, most existing GNNs and their graph similarity calculation methods primarily focus on undirected graphs. They typically employ symmetric operations (such as summation, averaging, and maximization) when aggregating neighbor information, making it difficult to effectively capture the directional information of edges and the resulting asymmetric structural characteristics when processing directed graphs. Directed graphs are crucial in many applications, such as program control flow graphs, citation networks, and social influence graphs, where the directionality of edges contains important semantic information. Existing methods that simply convert directed graphs to undirected graphs lose crucial directional information; while simple edge direction encoding often fails to fully utilize the complex asymmetric structure of directed graphs. Furthermore, existing graph similarity methods typically use simple dot product or cosine similarity in the graph matching stage, making it difficult to capture the complex high-order interaction information between two graph embeddings. More complex Neural Tensor Networks (NTNs) face the problems of huge parameter counts and low computational efficiency. Summary of the Invention

[0007] The present invention aims to at least partially solve one of the technical problems existing in the related art.

[0008] One objective of this invention is to provide a directed graph similarity calculation method based on directed graph matching networks, which effectively captures the asymmetric structural information and directional semantics of directed graphs, and achieves high-precision similarity prediction while ensuring computational efficiency.

[0009] Another objective of this invention is to provide a directed graph similarity calculation system based on a directed graph matching network.

[0010] To achieve the above objectives, the present invention provides a method for calculating the similarity of directed graphs based on directed graph matching networks, comprising the following steps:

[0011] S1. Input the two directed graphs to be compared into a directed graph isomorphic network for encoding, capture the asymmetric structure and direction information of the directed graphs, generate the source embedding and target embedding of the nodes, and obtain the two encoded directed graphs.

[0012] S2. Perform dual-view graph pooling on the encoded directed graph to generate a graph-level embedding with directional semantics from both the structural information of the nodes and the directional flow information of the edges, so as to extract a comprehensive graph-level representation of the directed graph.

[0013] S3. Use a low-rank neural network tensor network to match two directed graphs, calculate the nonlinear interaction relationship between the full graph-level representations of the two directed graphs, and obtain the predicted similarity score between the two directed graphs.

[0014] S4. Construct a directed graph similarity prediction model that executes steps S1 to S3, and train and optimize the model parameters by minimizing the error between the predicted similarity and the actual similarity to obtain a trained directed graph similarity prediction model. This model can be applied to similarity calculation between directed graphs of the same type, such as social networks, protein-protein interaction networks, molecular structures, program control flow graphs, knowledge graphs, citation networks, or social influence graphs.

[0015] A further preferred technical solution of the present invention is as follows: Step S1 involves inputting the two directed graphs to be compared into a directed graph isomorphic network for encoding, capturing the asymmetric structure and direction information of the directed graphs, generating source embeddings and target embeddings of nodes, and obtaining the two encoded directed graphs; specifically:

[0016] S11. For any directed graph that is isomorphic to the input directed graph network. any node in Generate its initial embedding, including the initial source embedding. and initial target embedding ;

[0017] S12. Directed graph isomorphic networks employ a multi-layered iterative bidirectional message-passing mechanism to mutually update the source and target embeddings; for the... Layers, nodes Source embedding and target embedding The update rule is expressed as:

[0018] ;

[0019] ;

[0020] in, and They represent the first Source embedding and target embedding of the layer; Represents a node All direct outgoing neighbors; Represents a node All directly adjacent sets; summation symbol This represents summing and aggregating neighbor embeddings to form a multiset representation; and It is the first The learnable scalar parameters of the layer are used to balance the contributions of a node’s own embedding and the aggregated embeddings of its neighbors; and It is the first A multilayer perceptron, where each MLP consists of multiple fully connected layers and nonlinear activation functions.

[0021] Preferably, in step S11, for any directed graph of the input directed graph isomorphic network... any node in According to the node Whether it has a tag, generate its initial embedding, specifically:

[0022] For nodes with labels, the node The initial source embedding is generated by concatenating the out-degree of its one-hot encoding and the node label features through linear transformation, and is represented as:

[0023] ;

[0024] node The initial target embedding is generated by concatenating the in-degree of its one-hot encoding and the node label features through linear transformation, and is represented as:

[0025] ;

[0026] For unlabeled nodes, the node The initial source embedding is generated by linearly transforming the out-degree of its one-hot encoding, as follows:

[0027] ;

[0028] node The initial target embedding is generated by linearly transforming the in-degree of its one-hot encoding, as follows:

[0029] ;

[0030] in, Represents a node The out-degree of the one-hot encoding form, Represents a node The in-degree of the one-hot encoding form, It is a node One-hot encoded tags, This represents a vector concatenation operation; It is a learnable weight matrix. These are learnable bias vectors; these weights and biases project the initial features of the nodes onto a unified plane. Hidden space.

[0031] Preferably, in step S2, dual-view graph pooling is performed on the encoded directed graph to generate a graph-level embedding with directional semantics from both the structural information of nodes and the directional flow information of edges, so as to extract a comprehensive graph-level representation of the directed graph; specifically:

[0032] S21. Perform node-view pooling, using an attention-based pooling mechanism to aggregate the final embedding of nodes. First, each node... The final source embedding and the final target embedding Concatenate them into a single node representation ;

[0033] Then, a global context vector is computed. :

[0034] ;

[0035] in, It is a learnable attention weight matrix used to linearly transform the concatenated node embeddings in order to capture global information; It is a non-linear activation function that compresses the input activation values ​​to... Scope;

[0036] Based on global context vector Calculate the node weight for each node. This reflects its importance in the global representation of the graph, and is expressed as:

[0037] ;

[0038] in, It is a learnable weight matrix; It is a learnable bias vector; It is a non-linear activation function; This represents the dot product, which embeds the transformed nodes and matches them with the global context vector. The function is used to normalize the attention weights so that the sum of the weights of all nodes is 1;

[0039] Final node view graph embedding Obtained through attention-weighted aggregation, and represented as:

[0040] ;

[0041] S22. Perform edge-view pooling to explicitly capture the edge-level directional semantics in the directed graph. For each directed edge in the directed graph... Its edge is embedded Define as source node Target embedding and target node The nonlinear mapping of the difference between the source embeddings is expressed as:

[0042] ;

[0043] It is a multilayer perceptron used to transfer data from nodes. As an information source to the node The semantic offset of the information receiver is transformed into a meaningful edge representation. ;

[0044] Using edge betweenness centrality as a weighting scheme, edges are quantified. The importance of connecting paths in a graph, calculating edges. The centrality score of the intermediary:

[0045] ;

[0046] in, It is a node To the node The total number of shortest paths, It is through the border The number of shortest paths; normalizing the betweenness centrality score as the edge weight. :

[0047] ;

[0048] Final side view graph embedding The calculation is as follows:

[0049] ;

[0050] S23. Embed the node view graph and edge view graph embedding By splicing the data, a comprehensive graph-level representation of the directed graph is formed. , represented as:

[0051] .

[0052] Preferably, in step S3, a low-rank neural network tensor network is used to match the two directed graphs, calculate the nonlinear interaction relationship between the full graph-level representations of the two directed graphs, and obtain the predicted similarity score between the two directed graphs; specifically:

[0053] S31. Represent the full graph level of two directed graphs. Projecting onto a lower-dimensional space, they are represented as follows:

[0054] ;

[0055] ;

[0056] in, and It is a learnable projection matrix; and It is an embedding after low-dimensional projection;

[0057] S32, Through Learnable Core Tensors The interaction relationships between the embeddings of two directed graphs after low-dimensional projection are computed using the Einstein summation convention, generating bilinear vectors. , represented as:

[0058] ;

[0059] in , representing the first of the output vector One portion, Represents the number of "tensor neurons"; bilinear operations capture the complex cross-feature interactions between two graph embeddings, modeling the interaction between two input vectors by learning a core tensor;

[0060] The generated bilinear vector It was then projected onto the final screen. 3D interaction vector:

[0061] ;

[0062] in, It is a learnable projection matrix;

[0063] S33. Capture the linear relationship between the concatenated original inputs through another linear path to generate a linear vector. , represented as:

[0064] ;

[0065] in, It is a learnable weight matrix;

[0066] S34, Combining bilinear vectors and linear vectors And by activating it through an activation function, the final output is obtained. , represented as:

[0067] ;

[0068] in, It is a learnable bias vector;

[0069] S35, Final Output The final similarity score is mapped through a fully connected layer. , represented as:

[0070] ;

[0071] in, This represents a fully connected layer. It is the Sigmoid activation function, which restricts the score range to [0,1], thus representing the normalized similarity value.

[0072] Preferably, in step S4, when training and optimizing the model parameters by minimizing the error between the predicted similarity and the true similarity, the mean squared error is used as the loss function to measure the difference between the predicted similarity and the true similarity, expressed as:

[0073] ;

[0074] in, It is a set of training image pairs. It is the model predicting similarity. It is the true similarity calculated based on the edit distance of the normalized graph.

[0075] The model was trained using the Adam optimizer with a learning rate of 0.001. An early stopping mechanism was used during training; if the loss on the validation set did not improve within 30 consecutive epochs, training was stopped.

[0076] Another aspect of the present invention provides a directed graph similarity calculation system based on a directed graph matching network, comprising:

[0077] The model building module is used to build a directed graph similarity prediction model, which is constructed as follows:

[0078] The two directed graphs to be compared are input into a directed graph isomorphic network for encoding, capturing the asymmetric structure and orientation information of the directed graphs, generating source embeddings and target embeddings of nodes, and obtaining the two encoded directed graphs.

[0079] The encoded directed graph is subjected to dual-view graph pooling to generate a graph-level embedding with directional semantics from both the structural information of nodes and the directional flow information of edges, so as to extract a comprehensive graph-level representation of the directed graph.

[0080] Two directed graphs are matched using a low-rank neural network tensor network. The nonlinear interaction relationship between the full graph-level representations of the two directed graphs is calculated to obtain the predicted similarity score between the two directed graphs.

[0081] The model training module uses the pre-acquired dataset to train and optimize the parameters of the directed graph similarity prediction model by minimizing the error between the predicted similarity and the true similarity, thereby obtaining the trained directed graph similarity prediction model.

[0082] The directed graph similarity calculation module takes two directed graphs of the same type (social network, protein interaction network, molecular structure, program control flow graph, knowledge graph, citation network, or social influence graph) as input, and outputs the similarity prediction results of the two directed graphs through a trained directed graph similarity prediction model.

[0083] In another aspect, the present invention provides a non-transitory computer-readable storage medium having computer instructions stored thereon, the computer instructions causing a computer to execute the above-described directed graph similarity calculation method based on a directed graph matching network.

[0084] In another aspect, the present invention provides an electronic device, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus, and the processor calls logical instructions in the memory to execute the above-mentioned directed graph similarity calculation method based on directed graph matching network.

[0085] In another aspect, the present invention provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer executes the above-described directed graph similarity calculation method based on a directed graph matching network.

[0086] The present invention provides a method and system for calculating the similarity of directed graphs based on directed graph matching networks. This method fully utilizes the structural information and directional semantics of directed graphs, and achieves high-precision similarity prediction while ensuring computational efficiency. Specifically, the present invention has the following beneficial effects:

[0087] (1) This invention achieves accurate modeling of the asymmetric structure and directional information of directed graphs by introducing a directed graph isomorphic network (DiGIN) and a dual-view graph pooling mechanism. DiGIN systematically captures the in-degree and out-degree information of nodes by generating source and target embeddings, significantly improving the shortcomings of traditional graph neural networks in modeling directional information when processing directed graphs. Combined with the weight allocation based on edge betweenness centrality in edge-view pooling, this invention can explicitly express directional semantics from both node and edge levels, constructing a more comprehensive and discriminative graph-level representation.

[0088] (2) This invention utilizes a low-rank neural network tensor network (LR-NTN) for graph matching, significantly optimizing computational efficiency and model scalability. LR-NTN borrows from the Tucker decomposition concept, significantly reducing the number of parameters in traditional tensor networks. While maintaining or even surpassing the performance of standard NTN, it achieves efficient graph interaction computation. This parameterized design, combined with the efficient message passing mechanism of the DiGIN encoder, enables the entire DiGIN model to exhibit superior computational performance when processing large-scale directed graph data. Experiments show that on the OGBG-CODE2 dataset, the DiGIN encoder accelerates inference time by 31.8%, and LR-NTN accelerates inference time by 13.8%, significantly improving overall inference efficiency and fully meeting the real-time and scalability requirements of large-scale directed graph similarity computation.

[0089] (3) This invention provides an end-to-end directed graph similarity calculation framework, which integrates the directed structure encoding capability of DiGIN, the comprehensive graph representation construction capability of dual-view pooling, and the efficient and accurate matching capability of LR-NTN, significantly improving the generalization performance and robustness of the model on various directed graph datasets. Attached Figure Description

[0090] Figure 1 This is a flowchart of the directed graph similarity calculation method based on directed graph matching networks according to the present invention.

[0091] Figure 2 This is a framework diagram of the directed graph similarity prediction model constructed in this invention. Detailed Implementation

[0092] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, embodiments of this invention, and should not be construed as limiting the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention. In the description of this invention, it should be understood that the terminology used is for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0093] The following is combined Figures 1-2 This invention describes the method and system for calculating directed graph similarity based on directed graph matching networks.

[0094] Example 1: The main challenges currently facing the field of graph similarity calculation are:

[0095] 1. Insufficient modeling of the directionality of directed graphs: Existing GNNs often struggle to effectively encode and utilize the directionality of edges and the resulting asymmetric structures when processing directed graphs.

[0096] 2. Lack of semantics in graph-level representation: When aggregating graph-level representations, the directional semantics of nodes and edges are not fully integrated, resulting in limited expressive power of graph embedding.

[0097] 3. Trade-off between efficiency and accuracy in graph matching: Traditional matching mechanisms are inefficient, while more complex matching methods may face problems such as large number of parameters and high computational cost, making them difficult to apply to large-scale datasets.

[0098] Therefore, there is an urgent need for a method that can efficiently and accurately calculate the similarity of directed graphs. This method should be able to make full use of the structural information and directional semantics of directed graphs, and achieve high-precision similarity prediction while ensuring computational efficiency.

[0099] Accordingly, this embodiment provides a method for calculating the similarity of directed graphs based on a directed graph matching network. The essence of this method is to construct a Directed Graph Matching Network (DiGMN), an end-to-end neural network framework specifically designed to learn the similarity between directed graphs. The core of DiGMN lies in systematically handling the directional modeling of directed graphs, mainly implemented through three parts: a Directed Graph Isomorphism Network (DiGIN), a dual-view graph pooling mechanism, and a Low-Rank Neural Tensor Network (LR-NTN). The following will elaborate on the specific implementation methods of this network and its various components, as well as their interactions. Figure 1 , Figure 2 As shown.

[0100] S1. Input the two directed graphs to be compared into the Directed Graph Isomorphism Network (DiGIN) for encoding, capture the asymmetric structure and direction information of the directed graphs, generate the source embedding and target embedding of the nodes, and obtain the two encoded directed graphs.

[0101] This step aims to generate rich representations for each node in the directed graph that can distinguish between in-going connections and out-going connections. DiGIN's design is inspired by the directed Weisfeiler-Lehman (WL) test, which has been theoretically proven to have the same expressive power as the directed WL test, thus ensuring that it has the greatest discriminative power for different structures in directed graphs.

[0102] S11. Initial Embedding Generation: For any directed graph in the input directed graph isomorphic network. any node in According to the node Whether it has a tag, generate its initial embedding, including the initial source embedding. and initial target embedding :

[0103] For nodes with labels, the node The initial source embedding is generated by concatenating the out-degree of its one-hot encoding and the node label features through linear transformation, and is represented as:

[0104] ;

[0105] node The initial target embedding is generated by concatenating the in-degree of its one-hot encoding and the node label features through linear transformation, and is represented as:

[0106] ;

[0107] For unlabeled nodes, the node The initial source embedding is generated by linearly transforming the out-degree of its one-hot encoding, as follows:

[0108] ;

[0109] node The initial target embedding is generated by linearly transforming the in-degree of its one-hot encoding, as follows:

[0110] ;

[0111] in, Represents a node The out-degree of the one-hot encoding form, Represents a node The in-degree of the one-hot encoding form, It is a node One-hot encoded tags, This represents a vector concatenation operation; It is a learnable weight matrix. These are learnable bias vectors; these weights and biases project the initial features of the nodes onto a unified plane. Hidden space.

[0112] S12. Bidirectional Message Passing and Embedding Update: DiGIN employs a multi-layered iterative bidirectional message passing mechanism, where the source embedding and target embedding update each other to capture a wider range of local and non-local structural information of the nodes; for the... Layers, nodes Source embedding and target embedding The update rule is expressed as:

[0113] ;

[0114] ;

[0115] in, and They represent the first Source embedding and target embedding of the layer; Represents a node The set of all direct outgoing neighbors, i.e., satisfying All nodes A set; Represents a node The set of all directly incoming neighbors, i.e., satisfying All nodes Sets; Summation symbol This represents the summation and aggregation of neighbor embeddings to form a multiset representation, which corresponds to the aggregation method of neighbor colors in the directed WL test; and It is the first The learnable scalar parameters of the layer are used to balance the contributions of the node’s own embedding (representing the node’s own features or “self-loop” messages) and its neighbor’s aggregated embedding. This mechanism allows the model to adaptively adjust the weights of the central node and neighbor information based on the data, thereby enhancing the model’s expressive power. and It is the first A multilayer perceptron, each MLP consists of multiple fully connected layers and nonlinear activation functions (such as ReLU), which are used to perform nonlinear transformations on the aggregated features, mapping the aggregated information to a new, more discriminative embedding space.

[0116] S2. Perform dual-view graph pooling on the encoded directed graph to generate a graph-level embedding with directional semantics from both the structural information of the nodes and the directional flow information of the edges, so as to extract a comprehensive graph-level representation of the directed graph.

[0117] This step aims to generate a comprehensive graph-level embedding with directional semantics for the entire graph by considering both the structural information of the nodes and the directional flow information of the edges.

[0118] S21, Node-view pooling: An attention-based pooling mechanism is used to aggregate the final embeddings of nodes. First, each node... The final source embedding and the final target embedding Concatenate them into a single node representation:

[0119] ;

[0120] Then, a global context vector is computed. :

[0121] ;

[0122] in, It is a learnable attention weight matrix used to linearly transform the concatenated node embeddings in order to capture global information; It is a non-linear activation function that compresses the input activation values ​​to... Scope;

[0123] Based on global context vector Calculate the node weight for each node. This reflects its importance in the global representation of the graph, and is expressed as:

[0124] ;

[0125] in, It is a learnable weight matrix; It is a learnable bias vector. It is the intermediate dimension in the attention mechanism; It is a nonlinear activation function used to introduce nonlinearity; This represents the dot product, which embeds the transformed nodes and matches them with the global context vector. The function is used to normalize the attention weights so that the sum of the weights of all nodes is 1; this attention mechanism allows the model to dynamically identify nodes that contribute more to the overall representation of the graph.

[0126] Final node view graph embedding Obtained through attention-weighted aggregation, and represented as:

[0127] ;

[0128] This step enables the model to dynamically aggregate node information based on the importance of nodes, forming a representation that reflects the overall semantics of the nodes in the graph.

[0129] S22, Edge-view Pooling: To explicitly capture edge-level directional semantics in a directed graph, for each directed edge in the directed graph... Its edge is embedded (dimension is) Defined as source node Target embedding and target node The nonlinear mapping of the difference between the source embeddings is expressed as:

[0130] ;

[0131] This interpolation operation Effectively captures the source node in the embedding space To the target node The direction of flow and semantic transformation. For example, it represents the flow from... As a source of information The semantic "leap" or "flow" of information receivers. It is a multilayer perceptron used to convert this semantic shift into Meaningful edge representation of a dimension .

[0132] To obtain the edge-view graph representation, the betweenness centrality (BC(e)) of the edges is used as a weighting scheme to quantify the edges. The importance of connecting paths in a graph, calculating edges. The centrality score of the intermediary:

[0133] ;

[0134] in, It is a node To the node The total number of shortest paths, It is through the border The shortest path count; the betweenness centrality score reflects the "bridging" role of an edge in the information flow or control flow, and the higher the score, the more important the edge is in the connection of the graph. The betweenness centrality score is normalized and used as the edge weight. :

[0135] ;

[0136] Final side view graph embedding The calculation is as follows:

[0137] ;

[0138] In this step, edge-view pooling aggregates the most important directional connectivity information in the graph, forming a graph representation with edge-level directional semantics. The introduction of betweenness centrality weights allows the model to prioritize edges that play a key role in the graph's connectivity, thereby more accurately capturing the overall structure and information flow of the graph.

[0139] S23, Dual-view embedding and fusion: embedding the node view graph and edge view graph embedding By splicing the data, a comprehensive graph-level representation of the directed graph is formed. , represented as:

[0140] ;

[0141] in, It is the total dimension after splicing.

[0142] fused graph embedding It includes the structural patterns and directional relationships of the graph, and integrates node-level attention and edge-level importance, providing a comprehensive and directional representation for subsequent graph matching.

[0143] S3. Use a low-rank neural network tensor network (LR-NTN) to match two directed graphs, calculate the nonlinear interaction relationship between the full graph-level representations of the two directed graphs, and obtain the predicted similarity score between the two directed graphs.

[0144] This step aims to efficiently compute two graph-level representations. and The complex nonlinear interactions between them are used to derive graph similarity. Traditional Neural Tensor Networks (NTNs) suffer from large parameter counts and high computational complexity. LR-NTN, by borrowing the Tucker decomposition idea, significantly reduces parameter complexity and computational cost.

[0145] S31, Low-rank projection: Graph embedding for two graphs First, project it into a lower-dimensional space (rank). This projection reduces computational complexity. It maps high-dimensional, potentially redundant features to a more compact and expressive low-dimensional space, while also aiding in denoising and capturing more essential features, as shown below:

[0146] ;

[0147] ;

[0148] in, and It is a learnable projection matrix; and It is an embedding after low-dimensional projection; It is a low-dimensional space rank, and ;

[0149] S32, Core Bilinear Interactions: Core bilinear interactions between low-dimensional embeddings via learnable core tensors (in The intermediate output dimension (representing the number of "tensor neurons") is calculated using Einstein's summation convention and is expressed as:

[0150] ;

[0151] in , representing the first of the output vector Each component; the bilinear operation captures the complex cross-feature interactions between two graph embeddings, modeling the interaction between the two input vectors by learning a core tensor;

[0152] The generated bilinear vector It was then projected onto the final screen. 3D interaction vector:

[0153] ;

[0154] in, It is a learnable projection matrix;

[0155] S33. Linear Path: In addition to the bilinear path, LR-NTN also includes a linear path to directly capture the linear relationships between the concatenated original inputs. This linear relationship complements the bilinear interaction, helps capture simpler feature correspondences, and provides a "skip connection" for information flow, represented as:

[0156] ;

[0157] in, It is a learnable weight matrix;

[0158] S34, Final Output: The final output of LR-NTN The activation of both bilinear and linear paths is combined and represented as:

[0159] ;

[0160] in, It is a learnable bias vector;

[0161] Through this low-rank parameterization, LR-NTN reduces the number of parameters from that of standard NTN. Significantly reduced to This design enables the model to achieve efficient and powerful graph similarity computation while maintaining or even surpassing the performance of standard NTN, making it applicable to large-scale graph datasets.

[0162] S35. Similarity score calculation: The final output will be... The final similarity score is mapped through a fully connected layer (FC layer). , represented as:

[0163] ;

[0164] in, This represents a fully connected layer used to... The interaction vectors of the dimensionality are mapped to a single similarity scalar value; It is the Sigmoid activation function, which restricts the score range to [0,1], thus representing the normalized similarity value.

[0165] The steps S1-S3 above describe the overall structure of a Directed Graph Matching Network (DiGMN) and the specific implementation methods of each component in calculating directed graph similarity. The following section describes how to train the DiGMN to make its predicted similarity as close as possible to the true value.

[0166] S4. Construct a directed graph similarity prediction model that executes steps S1 to S3, and train and optimize the model parameters by minimizing the error between the predicted similarity and the actual similarity to obtain a trained directed graph similarity prediction model. This model can be applied to similarity calculation between directed graphs of the same type, such as social networks, protein-protein interaction networks, molecular structures, program control flow graphs, knowledge graphs, citation networks, or social influence graphs.

[0167] During training, mean squared error is used as the loss function to measure the difference between predicted similarity and true similarity, expressed as:

[0168] ;

[0169] in, It is a set of training image pairs. It is the model predicting similarity. This is the true similarity calculated based on the normalized graph edit distance (GED). GED is defined as the minimum cost required to transform one graph into another through atomic operations such as inserting, deleting, and relabeling nodes or edges. The normalized GED is defined as:

[0170] ;

[0171] in, and The figures are respectively and The number of nodes. For small-scale graphs, this invention uses the DF-GED (Double-ended Fast Graph Edit Distance) algorithm to calculate the accurate GED value as a monitoring signal. For large-scale graphs, since accurate GED calculation is an NP-complete problem with high computational cost, this invention can employ various approximation algorithms (including Beam search-based algorithms, Hungarian algorithm-based methods, and VJ algorithm) to calculate approximate GED values, and take the minimum of all approximations as the true GED value to achieve a balance between computational efficiency and approximation accuracy.

[0172] Model training employs the Adam optimizer (Adaptive Moment Estimation), with a learning rate typically set to 0.001. The Adam optimizer combines the advantages of Adagrad and RMSprop, adaptively adjusting the learning rate for each parameter to accelerate the training process and improve convergence stability. Early stopping is used during training; for example, patience is set to 30 epochs, meaning training stops if the loss on the validation set does not improve within 30 consecutive epochs. This mechanism helps prevent overfitting of the training data and ensures good generalization ability.

[0173] Example 2: A directed graph similarity calculation system based on a directed graph matching network, comprising:

[0174] The model building module is used to build a directed graph similarity prediction model, which is constructed by including:

[0175] The graph data input submodule is responsible for receiving directed graph data to be processed. Its main functions include data reading, format conversion, and batch processing. In its implementation, this module utilizes the `torch_geometric.data.DataLoader` component of the PyTorchGeometric library in Python to efficiently read graph structure information (including nodes, edges, and their orientations) and node features (such as node labels and degree information) from the file system or database. This module parses the graph data into tensor format and organizes it into batches to meet the parallel processing requirements of deep learning models.

[0176] The graph encoding submodule (DiGIN implementation) is the core computational part of the model, responsible for encoding each node in the input directed graph data. It generates source and target embeddings for nodes that capture the asymmetric structure and orientation information of the directed graph by executing the DiGIN algorithm. This module is implemented in the PyTorch framework as a series of stacked DiGIN layers. Each DiGIN layer consists of a learnable weight matrix, a bias vector, and a multilayer perceptron (MLP). To accelerate computation, this module fully utilizes the parallel computing power of the graphics processing unit (GPU) to perform efficient matrix multiplication, tensor summation, and nonlinear activation function operations. PyTorch's automatic differentiation function plays a crucial role in the parameter optimization process of this module.

[0177] The graph pooling submodule (dual-view graph pooling implementation): This module receives the node source embeddings and target embeddings output by the graph coding module and aggregates them into a single, comprehensive graph-level representation. This submodule consists of two branches:

[0178] (1) Node-view pooling branch: This branch implements aggregation based on an attention mechanism. It contains a learnable attention weight matrix and related linear layers. The node-view pooling branch generates a node-view graph embedding by calculating the attention weight of each node and performing a weighted sum of its node embeddings. .

[0179] (2) Edge-view Pooling Branch: This branch is responsible for computing the embedding of each directed edge and weighting it according to the edge's betweenness centrality, which is calculated pre-computed or at runtime. The betweenness centrality of the edges is calculated using an algorithm from a graph analysis library. The edge embedding is calculated from the difference of node embeddings by an MLP. The edge-view pooling branch aggregates the weighted edge embeddings to generate the edge-view graph embedding. .

[0180] The output tensors of these two branches are concatenated on the GPU to form the final fused graph representation hG.

[0181] Graph Matching Submodule (LR-NTN Implementation): This module receives the graph-level representations of the two graphs output by the graph pooling module. and The module performs efficient interaction matching using the LR-NTN algorithm, ultimately outputting a score representing the similarity between graphs. It contains a learnable low-rank projection matrix, a core tensor, and linear transformation matrices and bias terms. It performs complex tensor operations such as tensor multiplication and Einstein summation on the GPU to achieve efficient graph pair interactions. The low-rank decomposition of LR-NTN is implemented in PyTorch through appropriate matrix multiplication and tensor reshaping operations, ensuring computational efficiency. The final output is normalized using the Sigmoid function.

[0182] The model training module uses the pre-acquired dataset to train and optimize the parameters of the directed graph similarity prediction model by minimizing the error between the predicted similarity and the true similarity, thereby obtaining the trained directed graph similarity prediction model.

[0183] The directed graph similarity calculation module formats and outputs the final calculated directed graph similarity score. This module can be a simple API interface or function that formats the final output (a sigmoid-activated floating-point number) from the graph matching module and returns it to the user or for use by other downstream applications. This module takes two similar directed graphs (social networks, protein-protein interaction networks, molecular structures, program control flow graphs, knowledge graphs, citation networks, or social influence graphs) as input, and outputs the predicted similarity between the two graphs using a trained directed graph similarity prediction model.

[0184] Example 3: This example provides a non-transitory computer-readable storage medium storing computer instructions that cause a computer to execute a directed graph similarity calculation method based on a directed graph matching network. The method includes the following steps:

[0185] S1. Input the two directed graphs to be compared into a directed graph isomorphic network for encoding, capture the asymmetric structure and direction information of the directed graphs, generate the source embedding and target embedding of the nodes, and obtain the two encoded directed graphs.

[0186] S2. Perform dual-view graph pooling on the encoded directed graph to generate a graph-level embedding with directional semantics from both the structural information of the nodes and the directional flow information of the edges, so as to extract a comprehensive graph-level representation of the directed graph.

[0187] S3. Use a low-rank neural network tensor network to match two directed graphs, calculate the nonlinear interaction relationship between the full graph-level representations of the two directed graphs, and obtain the predicted similarity score between the two directed graphs.

[0188] S4. Construct a directed graph similarity prediction model that executes steps S1 to S3, and train and optimize the model parameters by minimizing the error between the predicted similarity and the actual similarity to obtain a trained directed graph similarity prediction model. This model can be applied to similarity calculation between directed graphs of the same type, such as social networks, protein-protein interaction networks, molecular structures, program control flow graphs, knowledge graphs, citation networks, or social influence graphs.

[0189] Example 4: This example provides an electronic device that may include a processor, a communication interface, a memory, and a communication bus. The processor, communication interface, and memory communicate with each other via the communication bus. The processor can call logical instructions from the memory to execute a directed graph similarity calculation method based on a directed graph matching network. This method includes the following steps:

[0190] S1. Input the two directed graphs to be compared into a directed graph isomorphic network for encoding, capture the asymmetric structure and direction information of the directed graphs, generate the source embedding and target embedding of the nodes, and obtain the two encoded directed graphs.

[0191] S2. Perform dual-view graph pooling on the encoded directed graph to generate a graph-level embedding with directional semantics from both the structural information of the nodes and the directional flow information of the edges, so as to extract a comprehensive graph-level representation of the directed graph.

[0192] S3. Use a low-rank neural network tensor network to match two directed graphs, calculate the nonlinear interaction relationship between the full graph-level representations of the two directed graphs, and obtain the predicted similarity score between the two directed graphs.

[0193] S4. Construct a directed graph similarity prediction model that executes steps S1 to S3, and train and optimize the model parameters by minimizing the error between the predicted similarity and the actual similarity to obtain a trained directed graph similarity prediction model. This model can be applied to similarity calculation between directed graphs of the same type, such as social networks, protein-protein interaction networks, molecular structures, program control flow graphs, knowledge graphs, citation networks, or social influence graphs.

[0194] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0195] Example 5: This example provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute a directed graph similarity calculation method based on a directed graph matching network. The method includes the following steps:

[0196] S1. Input the two directed graphs to be compared into a directed graph isomorphic network for encoding, capture the asymmetric structure and direction information of the directed graphs, generate the source embedding and target embedding of the nodes, and obtain the two encoded directed graphs.

[0197] S2. Perform dual-view graph pooling on the encoded directed graph to generate a graph-level embedding with directional semantics from both the structural information of the nodes and the directional flow information of the edges, so as to extract a comprehensive graph-level representation of the directed graph.

[0198] S3. Use a low-rank neural network tensor network to match two directed graphs, calculate the nonlinear interaction relationship between the full graph-level representations of the two directed graphs, and obtain the predicted similarity score between the two directed graphs.

[0199] S4. Construct a directed graph similarity prediction model that executes steps S1 to S3, and train and optimize the model parameters by minimizing the error between the predicted similarity and the actual similarity to obtain a trained directed graph similarity prediction model. This model can be applied to similarity calculation between directed graphs of the same type, such as social networks, protein-protein interaction networks, molecular structures, program control flow graphs, knowledge graphs, citation networks, or social influence graphs.

[0200] To fully verify the effectiveness and superiority of the DiGMN method, this invention conducted extensive experiments on three representative directed graph datasets. The experimental environment was based on a standard deep learning workstation configuration, including NVIDIA GPU accelerated computing resources.

[0201] I. Experimental Dataset

[0202] This invention selected the following three representative directed graph datasets for model evaluation:

[0203] LINUX Dataset: This dataset contains 1000 program dependency graphs extracted from the Linux kernel. Each graph has between 4 and 10 nodes, which are unlabeled, and directed edges represent dependencies between program statements.

[0204] The Cora dataset consists of 600 directed subgraphs sampled from the original Cora citation network. Each subgraph has between 5 and 10 nodes, representing research papers and labeled with seven different machine learning subdomains. These subgraphs were sampled from randomly selected starting points using either Depth-First Search (DFS) or Breadth-First Search (BFS).

[0205] The OGBG-CODE2 dataset contains 1200 abstract syntax trees defined by Python methods. Each graph has between 20 and 30 nodes, with each node carrying one of 97 different labels, resulting in a complex and diverse structure.

[0206] In these datasets, the true similarity between graph pairs is widely distributed, covering a range from low to high similarity, which provides a robust basis for model evaluation.

[0207] II. Baseline Model and DiGMN Configuration

[0208] This invention compares the performance of DiGMN with a range of state-of-the-art graph similarity calculation methods, including but not limited to ERIC and GRASP. These baseline methods are configured according to the recommended settings in their original papers or publicly available implementations, including hyperparameters such as the number of GNN layers, hidden dimension, learning rate, training epochs, batch size, weight decay, and Dropout.

[0209] For the DiGMN model proposed in this invention, its hyperparameters, such as the number of DiGIN layers, embedding dimension, and rank of LR-NTN, have been meticulously tuned on the validation set through cross-validation to ensure optimal performance on different datasets. For example, a typical configuration may include 3 DiGIN layers, a hidden dimension of 64, and a rank of 10 for LR-NTN, with specific values ​​optimized according to the characteristics of the dataset.

[0210] III. Overall Performance Evaluation of DiGMN

[0211] In key evaluation metrics such as mean squared error (MSE), Spearman's ρ(ρ), Kendall's τ(τ), and p@k (top-k precision), the DiGMN proposed in this invention consistently and significantly outperforms existing state-of-the-art methods. Specific performance characteristics are as follows:

[0212] On the LINUX dataset: DiGMN's MSE is 0.1175±0.0163, Spearman's ρ is 0.9969±0.0002, and Kendall's τ is 0.9796±0.0009. It reaches 0.9723±0.0028 on the p@10 metric and 0.9843±0.0035 on the p@20 metric.

[0213] On the Cora dataset: DiGMN has an MSE of 0.3650±0.0234, Spearman's ρ is 0.9840±0.0010, and Kendall's τ is 0.9172±0.0025. It reaches 0.8753±0.0042 on the p@10 metric and 0.8849±0.0065 on the p@20 metric.

[0214] On the OGBG-CODE2 dataset: DiGMN's MSE is 1.4800±0.0307, ​​Spearman's ρ is 0.9119±0.0020, and Kendall's τ is 0.7671±0.0029. It achieves 0.3518±0.0078 on the p@10 metric and 0.4072±0.0078 on the p@20 metric.

[0215] Compared to existing technologies, DiGMN achieves an average improvement of 6.04% on Kendall's τ metric and an average improvement of 2.53% on Spearman's ρ metric. These results strongly demonstrate DiGMN's ability to effectively handle directional information and its overall superiority in directed graph similarity learning tasks.

[0216] IV. Contribution Analysis of Internal Model Components (Ablation Study)

[0217] To gain a deeper understanding of the independent contributions of each innovative module of DiGMN, this invention also conducted a series of ablation studies.

[0218] The Importance of DiGIN: Replacing the DiGIN encoder with the more general directed graph encoder DiGAE resulted in a significant drop in model performance. For example, on the OGBG-CODE2 dataset, the MSE deteriorated from 0.1175±0.0163 with DiGMN to 2.0799±0.0189, and p@10 dropped sharply from 0.3518±0.0078 to 0.2286±0.0046. This highlights the irreplaceable importance of DiGIN as a directed graph encoder in capturing asymmetric structural information of directed graphs.

[0219] Impact of edge-view pooling: When the edge-view module is removed and only node-view pooling is used, performance degrades, particularly on the Cora dataset, where MSE increases from 0.3650±0.0234 on DiGMN to 0.4546±0.0376, and p@10 decreases from 0.8753±0.0042 to 0.8483±0.0116. This indicates that explicitly modeling edge-level orientation information is crucial for generating accurate graph representations.

[0220] The effectiveness of betweenness centrality weighting: Replacing edge betweenness centrality pooling with simple mean pooling or max pooling also leads to a moderate decrease in performance. For example, on the LINUX dataset, the MSE increases to 0.1474±0.0206 under mean pooling and to 0.1176±0.0174 under max pooling, while the MSE of DiGMN is 0.1175±0.0163. This demonstrates the effectiveness of using betweenness centrality as a measure of edge importance, outperforming simple aggregation strategies.

[0221] Advantages of LR-NTN: Replacing LR-NTN with a standard neural network tensor network (NTN) with a larger number of parameters showed a performance decrease on both the Cora and OGBG-CODE2 datasets. For example, the MSE on the Cora dataset increased from 0.3650±0.0234 to 0.4214±0.0243. This demonstrates that LR-NTN can effectively maintain or even improve model performance while maintaining high efficiency through its low-rank design.

[0222] These ablation experiments clearly and sufficiently demonstrate that DiGIN, dual-view pooling (especially the side-view module), and LR-NTN are all indispensable key components of the success of the DiGMN framework.

[0223] In summary, this invention achieves accurate modeling of the asymmetric structure and directional information of directed graphs by introducing a Directed Graph Isomorphic Network (DiGIN) and a dual-view graph pooling mechanism. DiGIN systematically captures the in-degree and out-degree information of nodes by generating source and target embeddings, significantly improving the shortcomings of traditional graph neural networks in modeling directional information when processing directed graphs. Combined with the weight allocation based on edge betweenness centrality in edge-view pooling, this invention can explicitly express directional semantics from both node and edge levels, constructing a more comprehensive and discriminative graph-level representation. This method significantly improves the model's ability to understand the complex structure of directed graphs. Experimental results on directed graph datasets such as LINUX, Cora, and OGBG-CODE2 show that this invention improves performance by an average of 6.04% on Kendall's τ and an average of 2.53% on Spearman's ρ, effectively solving the problem of inaccurate similarity prediction caused by the lack of directional information in traditional methods when processing directed graphs.

[0224] This invention significantly optimizes computational efficiency and model scalability by employing a low-rank neural network tensor network (LR-NTN) for graph matching. LR-NTN borrows the Tucker decomposition idea, reducing the number of parameters in traditional tensor networks from... Significantly reduced to While maintaining or even surpassing the performance of standard NTN, it achieves efficient graph interaction computation. This parametric design, combined with the efficient message passing mechanism of the DiGIN encoder, enables the entire DiGMN model to exhibit superior computational performance when processing large-scale directed graph data. Experiments verify that on the OGBG-CODE2 dataset, the DiGIN encoder accelerates inference time by 31.8%, and LR-NTN accelerates inference time by 13.8%, resulting in a significant improvement in overall inference efficiency and fully meeting the real-time and scalability requirements of large-scale directed graph similarity computation.

[0225] This invention provides an end-to-end directed graph similarity calculation framework that integrates the directed structure encoding capability of DiGIN, the comprehensive graph representation construction capability of dual-view pooling, and the efficient and accurate matching capability of LR-NTN, significantly improving the model's generalization performance and robustness on various directed graph datasets. DiGMN consistently demonstrates leading performance on diverse directed graph datasets such as LINUX, Cora, and OGBG-CODE2, achieving a significant reduction in mean squared error (MSE) compared to existing state-of-the-art methods. Ablation studies further confirm that DiGIN, edge-view pooling, and LR-NTN are all indispensable key components of DiGMN's success, ensuring that the model can accurately handle directed graph similarity calculation tasks of different scales, features, and domains, providing more stable and accurate prediction capabilities.

[0226] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0227] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, 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 can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0228] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for calculating the similarity of directed graphs based on directed graph matching networks, characterized in that, Includes the following steps: S1. Input the two directed graphs to be compared into a directed graph isomorphic network for encoding, capture the asymmetric structure and direction information of the directed graphs, generate the source embedding and target embedding of the nodes, and obtain the two encoded directed graphs. S2. Perform dual-view graph pooling on the encoded directed graph to generate a graph-level embedding with directional semantics from both the structural information of the nodes and the directional flow information of the edges, so as to extract a comprehensive graph-level representation of the directed graph. S3. Use a low-rank neural network tensor network to match two directed graphs, calculate the nonlinear interaction relationship between the full graph-level representations of the two directed graphs, and obtain the predicted similarity score between the two directed graphs. S4. Construct a directed graph similarity prediction model that executes steps S1 to S3, and train and optimize the model parameters by minimizing the error between the predicted similarity and the actual similarity to obtain a trained directed graph similarity prediction model. This model can be applied to similarity calculation between directed graphs of the same type, such as social networks, protein-protein interaction networks, molecular structures, program control flow graphs, knowledge graphs, citation networks, or social influence graphs.

2. The method for calculating the similarity of directed graphs based on directed graph matching networks according to claim 1, characterized in that, Step S1 involves inputting the two directed graphs to be compared into a directed graph isomorphic network for encoding, capturing the asymmetric structure and direction information of the directed graphs, generating source embeddings and target embeddings of nodes, and obtaining the two encoded directed graphs; specifically: S11. For any directed graph that is isomorphic to the input directed graph network. any node in Generate its initial embedding, including the initial source embedding. and initial target embedding ; S12. Directed graph isomorphic networks employ a multi-layered iterative bidirectional message-passing mechanism to mutually update the source and target embeddings; for the... Layers, nodes Source embedding and target embedding The update rule is expressed as: ; ; in, and They represent the first Source embedding and target embedding of the layer; Represents a node All direct outgoing neighbors; Represents a node All directly adjacent sets; summation symbol This represents summing and aggregating neighbor embeddings to form a multiset representation; and It is the first The learnable scalar parameters of the layer are used to balance the contributions of a node’s own embedding and the aggregated embedding of its neighbors; and It is the first A multilayer perceptron, where each MLP consists of multiple fully connected layers and nonlinear activation functions.

3. The method for calculating the similarity of directed graphs based on directed graph matching networks according to claim 2, characterized in that, In step S11, for any directed graph of the input directed graph isomorphic network any node in According to the node Whether it has a tag, generate its initial embedding, specifically: For nodes with labels, the node The initial source embedding is generated by concatenating the out-degree of its one-hot encoding and the node label features through linear transformation, and is represented as: ; node The initial target embedding is generated by concatenating the in-degree of its one-hot encoding and the node label features through linear transformation, and is represented as: ; For unlabeled nodes, the node The initial source embedding is generated by linearly transforming the out-degree of its one-hot encoding, as follows: ; node The initial target embedding is generated by linearly transforming the in-degree of its one-hot encoding, as follows: ; in, Represents a node The out-degree of the one-hot encoding form, Represents a node The in-degree of the one-hot encoding form, It is a node One-hot encoded tags, This represents a vector concatenation operation; It is a learnable weight matrix. It is a learnable bias vector.

4. The method for calculating the similarity of directed graphs based on directed graph matching networks according to claim 2, characterized in that, In step S2, dual-view graph pooling is performed on the encoded directed graph to generate a graph-level embedding with directional semantics from both the structural information of nodes and the directional flow information of edges, so as to extract a comprehensive graph-level representation of the directed graph; specifically: S21. Perform node-view pooling, using an attention-based pooling mechanism to aggregate the final embedding of nodes. First, each node... The final source embedding and the final target embedding Concatenate them into a single node representation ; Then, a global context vector is computed. : ; in, It is a learnable attention weight matrix used to linearly transform the concatenated node embeddings in order to capture global information; It is a non-linear activation function that compresses the input activation values ​​to... Scope; Based on global context vector Calculate the node weight for each node. This reflects its importance in the global representation of the graph, and is expressed as: ; in, It is a learnable weight matrix; It is a learnable bias vector; It is a non-linear activation function; This represents the dot product, which matches the transformed node embeddings with the global context vector; The function is used to normalize the attention weights so that the sum of the weights of all nodes is 1; Final node view graph embedding Obtained through attention-weighted aggregation, and represented as: ; S22. Perform edge-view pooling to explicitly capture the edge-level directional semantics in the directed graph. For each directed edge in the directed graph... Its edge is embedded Define as source node Target embedding and target node The nonlinear mapping of the difference between the source embeddings is expressed as: ; It is a multilayer perceptron used to transfer data from nodes. As an information source to the node The semantic offset of the information receiver is transformed into a meaningful edge representation. ; Using edge betweenness centrality as a weighting scheme, edges are quantified. The importance of connecting paths in a graph, calculating edges. The centrality score of the intermediary: ; in, It is a node To the node The total number of shortest paths, It is through the border The number of shortest paths; normalizing the betweenness centrality score as the edge weight. : ; Final side view graph embedding The calculation is as follows: ; S23. Embed the node view graph and edge view graph embedding By splicing the data, a comprehensive graph-level representation of the directed graph is formed. , represented as: 。 5. The method for calculating the similarity of directed graphs based on directed graph matching networks according to claim 4, characterized in that, In step S3, a low-rank neural network tensor network is used to match two directed graphs, calculate the nonlinear interaction relationship between the full graph-level representations of the two directed graphs, and obtain the predicted similarity score between the two directed graphs; specifically: S31. Represent the full graph level of two directed graphs. Projecting onto a lower-dimensional space, they are represented as follows: ; ; in, and It is a learnable projection matrix; and It is an embedding after low-dimensional projection; S32, Through Learnable Core Tensors The interaction relationships between the embeddings of two directed graphs after low-dimensional projection are computed using the Einstein summation convention, generating bilinear vectors. , represented as: ; in , representing the first of the output vector One portion, Represents the number of "tensor neurons"; bilinear operations capture the complex cross-feature interactions between two graph embeddings, modeling the interaction between two input vectors by learning a core tensor; The generated bilinear vector This is then projected onto the final interaction vector: ; in, It is a learnable projection matrix; S33. Capture the linear relationship between the concatenated original inputs through another linear path to generate a linear vector. , represented as: ; in, It is a learnable weight matrix; S34, Combining Interaction Vectors and linear vectors And by activating it through an activation function, the final output is obtained. , represented as: ; in, It is a learnable bias vector; S35, Final Output The final similarity score is mapped through a fully connected layer. , represented as: ; in, This represents a fully connected layer. It is the Sigmoid activation function, which restricts the score range to [0,1], thus representing the normalized similarity value.

6. The method for calculating the similarity of directed graphs based on directed graph matching networks according to claim 1, characterized in that, In step S4, when training and optimizing the model parameters by minimizing the error between predicted similarity and true similarity, the mean squared error is used as the loss function to measure the difference between predicted similarity and true similarity, expressed as: ; in, It is a set of training image pairs. It is the model predicting similarity. The true similarity is calculated based on the edit distance of the normalized graph; The model was trained using the Adam optimizer with a learning rate of 0.

001. An early stopping mechanism was used during training; if the loss on the validation set did not improve within 30 consecutive epochs, training was stopped.

7. A directed graph similarity calculation system based on a directed graph matching network, characterized in that, include: The model building module is used to build a directed graph similarity prediction model, which is constructed as follows: The two directed graphs to be compared are input into a directed graph isomorphic network for encoding, capturing the asymmetric structure and orientation information of the directed graphs, generating source embeddings and target embeddings of nodes, and obtaining the two encoded directed graphs. The encoded directed graph is subjected to dual-view graph pooling to generate a graph-level embedding with directional semantics from both the structural information of nodes and the directional flow information of edges, so as to extract a comprehensive graph-level representation of the directed graph. Two directed graphs are matched using a low-rank neural network tensor network. The nonlinear interaction relationship between the full graph-level representations of the two directed graphs is calculated to obtain the predicted similarity score between the two directed graphs. The model training module uses the pre-acquired dataset to train and optimize the parameters of the directed graph similarity prediction model by minimizing the error between the predicted similarity and the true similarity, thereby obtaining the trained directed graph similarity prediction model. The directed graph similarity calculation module takes two directed graphs of the same type (social network, protein interaction network, molecular structure, program control flow graph, knowledge graph, citation network, or social influence graph) as input, and outputs the similarity prediction results of the two directed graphs through a trained directed graph similarity prediction model.

8. A non-transitory computer-readable storage medium, characterized in that, It stores computer instructions that cause the computer to execute the directed graph similarity calculation method based on a directed graph matching network as described in any one of claims 1-7.

9. An electronic device, characterized in that, include: The system includes a processor, a communication interface, a memory, and a communication bus. The processor, communication interface, and memory communicate with each other via the communication bus. The processor calls logical instructions from the memory to execute the directed graph similarity calculation method based on a directed graph matching network as described in any one of claims 1-7.

10. A computer program product, characterized in that, The computer program product includes a computer program stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer performs the directed graph similarity calculation method based on a directed graph matching network as described in any one of claims 1-7.