AWS Neptune - 介数中心性计算

问题描述 投票:0回答:1

我正在努力使用 Gremlin 在 AWS Neptune 中的图形上完成介数中心性计算。我正在使用 Gremlin 食谱:

g.V().as("v").
           repeat(both().simplePath().as("v")).emit(). 
           filter(project("x","y","z").by(select(first, "v")).
                                       by(select(last, "v")).
                                       by(select(all, "v").count(local)).as("triple").
                  coalesce(select("x","y").as("a").
                             select("triples").unfold().as("t").
                             select("x","y").where(eq("a")).
                             select("t"),
                           store("triples")).
                  select("z").as("length").
                  select("triple").select("z").where(eq("length"))).
           select(all, "v").unfold(). 
           groupCount().next() 

这在这个玩具图上效果很好,也来自食谱:

g.addV().property(id,'A').as('a').
           addV().property(id,'B').as('b').
           addV().property(id,'C').as('c').
           addV().property(id,'D').as('d').
           addV().property(id,'E').as('e').
           addV().property(id,'F').as('f').
           addE('next').from('a').to('b').
           addE('next').from('b').to('c').
           addE('next').from('b').to('d').
           addE('next').from('c').to('e').
           addE('next').from('d').to('e').
           addE('next').from('e').to('f').iterate()

但是当使用 Neptune 中预加载的 Movielens100k 数据集时,它无法在合理的时间内进行计算。大概这是因为图太大,中间中心性在计算上太昂贵了。 该图已在 Neptune 中正确加载,我可以进行标准遍历。

所以我的问题是:对于更大的图,可以使用 Gremlin 还是我们需要依赖 Networkx 和其他包,或者 Sparql 中是否有解决方案?所以我的问题是在 AWS Neptune 中计算中心性指标的最有效方法是什么?非常感谢!!

gremlin amazon-neptune
1个回答
1
投票

Gremlin 可能不是最好的解决方案,您可以尝试将 networkx 或 igraph python 库用于图形算法

https://aws.amazon.com/about-aws/whats-new/2022/06/amazon-neptune-simplifies-graph-analytics-machine-learning-workflows-python-integration/

© www.soinside.com 2019 - 2024. All rights reserved.