Hello,
I am trying to use prop_nodes but it doesn’t seem to do what I expect. I want to create a node feature based on predecessors features, recursively, basically:
node["h"] = node["c"] + \sum_{p: predecessor(node)} p["h"] * p["k"]
So, I am writing this:
order = dgl.topological_nodes_generator(g)
g.ndata["h"] = g.ndata["c"].clone()
msg_fn = lambda edges: {"m": edges.src["h"] * edges.src["k"]}
rdc_fn = lambda nodes: {"h": nodes.data["c"] + nodes.mailbox["m"].sum(1)}
g.prop_nodes(order[1:], msg_fn, rdc_fn)
But when I look at the feature “h” at the end, it is incorrect. I would appreciate any help.
PS: I am using dgl-cu102 0.5.2
Thanks!