How to implement directed labeled hypergraphs


I’m a beginner at Pytorch and was wondering the best method/framework/library to use for my problem. I need to apply Graph Neural Networks (GNNs) to relational data, represented in first-order logic. The GNN architecture I need to implement is given in the following paper in Algorithm 1. The only change with respect to the method proposed in the paper is that I need to add a global readout (i.e., compute a graph embedding) to each GNN layer, in what is known as a Aggregate-combine-Readout GNN or ACR-GNN.

I will represent the input data as a directed labeled hypergraph. This hypergraph will also allow for (hyper)edges with a single node and more than one hyperedge (although with different labels) between the same group of nodes.

I have seen that Pytorch Geometric can be used to work with graphs, GNNs, etc. However, I don’t know if it suits my specific representation as directed labeled hypergraphs. The closest thing I have seen in Pytorch is the class torch_geometric.nn.conv.HypergraphConv, which implements a hypergraph convolution operation, but I don’t know if it works for directed edges or assumes every edge is undirected.

Regarding the edge labels, each label represents a different “type” of edge, so I need to perform the message-passing computations separately for each edge type and then aggregate the results (messages) for each node for each edge type, as shown in the paper mentioned above.

Do you think I can rely on the functionality provided in Pytorch Geometric or I will need to implement this specific case of GNN by hand?

Thank you