有没有办法让 GraphSAGE 考虑加权边

Is there a way to allow GraphSAGE take into account weighted edges

目前,我正在使用一个很棒的 python 库 StellarGraph 来实现 GraphSAGE(图形神经网络),对于大多数用途,该库运行良好。

我现在的情况是,我的图表带有加权边 - 权重反映了某些关系相对于其他关系的相对重要性。换句话说,节点之间的某些链接具有较低的权重(低重要性),而另一些具有较高的权重(高重要性)。

在图形网络训练期间考虑权重的情况下,这对于聚类甚至节点分类非常有用。

有没有办法让 GraphSAGE / python StellarGraph 考虑加权边?

version 1.2.0 中的 StellarGraph 现在通过数据生成器的 weighted=True 参数支持此功能。

例如,对于GraphSAGE's GraphSAGENodeGenerator

G_generator = GraphSAGENodeGenerator(G, 50, [10,10], weighted=True)

关于这意味着什么的详细信息(引用pull request #1667 that fixed the relevant issue #462):

This expands GraphSAGE (undirected and directed) to support weighted sampling, where edges with higher weights are taken proportionally more often.

For example, suppose there's there's 4 edges from node A:

An unweighed walk starting at A will choose each of the edges with equal propability and so end up on B, C or D in proportion 1:1:2 (edge counts). A weighted walk will choose the edges proportional to the weights, so end up on the vertices in proportion 0:1:5 (sum of edge weight). (Worth specifically highlighting: a weighted walk will never chose the A-B edge because it has weight 0.)

支持边缘权重的全套算法通过the table of demos in the documentation中的“边缘权重”列标记。