-
Hi, First of all, thanks for writing this library! This makes graph neural network much more accessible to people like me! I have a use case that is quite different from all the examples given in the documents, so I have many questions on how to make things work. I have an undirected bipartite graph, with N type A nodes and M type B nodes. In addition, the edge is undirected but weighted, with weight being in range (0, 1).
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
One thought I about weighted edge: I can simply replace the sparse adjacency matrix containing 0/1 with the adjacency matrix with weight as its element. Do you think that will work? I think it depends on the implementation of layers here. |
Beta Was this translation helpful? Give feedback.
-
Message passing in bipartite graphs will send messages from source nodes to target nodes, and as such, will only give a new representation for the target nodes. All your code looks correct, besides that you also want to do message passing in reverse direction using the transposed adjacency matrix: conv1 = GATConv(in_channels=(num_features_type_A, num_features_type_B, out_channels=...)
conv2 = GATConv(in_channels=(num_features_type_B, num_features_type_A, out_channels=...)
out1 = conv1(x=(x_A, x_B), edge_index)
out2 = conv2(x=(x_B, x_A), edge_index[torch.tensor([1, 0]).as_tensor(edge_index)) Note that |
Beta Was this translation helpful? Give feedback.
Message passing in bipartite graphs will send messages from source nodes to target nodes, and as such, will only give a new representation for the target nodes. All your code looks correct, besides that you also want to do message passing in reverse direction using the transposed adjacency matrix:
Note that
GATConv
does not support edge weights, as it will compute an edge weight/attention score…