DGL自带的很多函数
看GAT之前,先看看DGL库自带的一些函数,遵循消息传播范式,DGL自带了很多消息函数和传播函数,都在Builtin message passing functions中,总的来说,DGL由两个api组成消息传播:
send(edges, message_func) :for computing the messages along the given edges
recv(nodes, reduce_func) : for collecting the in-coming messages, perform aggregation and so on.
细看这里的两个函数:
DGLGraph.send(edges='__ALL__', message_func='default')
:沿着给定的边发送消息,发送的方式是一个message_func
函数定义,返回边缘上的消息,稍后可以在目标节点(destination node)的邮箱(mailbox
)中获取。接收将消耗消息。
DGLGraph.recv(v='__ALL__', reduce_func='default', apply_node_func='default', inplace=False)
:接收和变换( reduce_func
)传入的消息,并更新节点v
的特征。可选的apply_node_func
函数在接收后更新节点特性。
例子如 https://docs.dgl.ai/generated/dgl.DGLGraph.recv.html#dgl.DGLGraph.recv 所示。
dgl.DGLGraph.update_all(message_func='default', reduce_func='default', apply_node_func='default')
:该函数通过所有边发送消息并更新所有节点。可选地,应用一个函数在接收后更新节点特征。这是上面两个函数的组合:send(self, sel