graphnn
graphnn copied to clipboard
About belief propagration implementation
In your paper, there are two schemes:
- mean field
- loopy belief propagation
in example of graph_classification
, there is only implementation of mean field
.
loopy belief propagation contains two phases:
- v_i_j, message from i to j, gather all i's neighbor messages, except from j
- v_i, message from all i's neighbor, plus its own message
I am curious about how to efficiently calculate v_i_j. Unlike mean field
, it simply do matrix multiplication. But loopy belief propagation
is some what complicated and it is not easy because we need to remove neighbor j when we calculate v_i_j. Of course, we can implement it by just set i's neighbor j to zero, when calculate v_i_j, but it is not efficient.
So any hint on that?
Hi there, please check out the pytorch implementation of structure2vec: https://github.com/Hanjun-Dai/pytorch_structure2vec
It contains both efficient implementation of mean field and loopy bp.