Message passing for directed graphs
See original GitHub issueHi, thanks for the great package. I find some potential unclarity of the message passing mechanism when applied to directed graphs. In particular, the edge_index
includes pairs of (i, j)
in the edge set, but the aggregation associated with the MessagePassing
class works by aggregating features from x_j
to x_i
, i.e. from target nodes to source nodes. This is fine for undirected graphs, but for directed graphs, we actually want to aggregate features flowing into a node (usually not the opposite way), so x_j
should be the “source node” and x_i
should be the “target node”. I find these terminologies in the documentation about “source” and “target” a bit misleading.
Perhaps if not changing the aggregation direction in the MessagePassing
code, in the definition of edge_index
, we should make it clear that a pair (i, j)
in edge_index
means that there is an edge from j
to i
, i.e. in the direction of j -> i
. This does not influence undirected graphs but helps to reduce errors in dealing with directed graphs.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (7 by maintainers)
Top GitHub Comments
Added to current master!
Both are fine. 1 is perhaps more systematic? Seems can do a minimal change by modifying
edge_index
toedge_index[torch.LongTensor([1, 0])]
inMessagePassing.propagate()
according to the direction flag.