【发布时间】:2021-07-22 14:54:34
【问题描述】:
我试图在图中找到一个连接组件中的所有节点,其中包含大约 130M 的顶点和大约 350M 的边。
以下是我用来查找连接组件中节点数的查询 -
输入 - 起始顶点 ID/名称
输出 - 连接组件中的节点数。
查询 - g.v().has("name", "driver1").repeat(where(without ("a")).store("a").both().simplePath().dedup()).emit().hasLabel("driver").count().fold()
上述查询大约需要 52 秒
RepeatStep 大约需要 29 秒
有没有一种方法可以优化 Repeatstep 中的线性遍历或 WherePredicateatep 中的查找?
上述查询的配置文件输出-
"dur": 29008.200345, "counts": ("traverserCount": 13809,"elementCount": 13809}, name: "RepeatStep ([Where PredicateStep (without ([a])), Profilestep, Storestep (a), Profilestep, JanuaGraphVertexStep(BOTH, vertex), ProfileStep, PathFilterstep(simple), Profilestep, RepeatEndstep, Profilestep], until(false), emit(true))", "annotations":{ "percentDur": 52.557919400750215}, "id": "2.0.0()", "metrics": [ { "dur": 38.137699, "counts":{ traverserCount: 13810, elementCount: 13810}, "name":"WherePredicateStep(without([a]))", "id": "0.1.0 (2.0.0())" }, { "dur": 28628.594393, "counts": { "traverserCount": 252428, "elementCount": 252428 }, name: "JanusGraphVertexStep (BOTH, vertex)", "annotations"
【问题讨论】:
-
对于您在此处询问 groups.google.com/g/gremlin-users/c/x3HwF_Ocr5g
-
是的,但是我还没有收到满意的回复,所以我也想在这里发布。
-
我会添加一个答案,但它与 Gremlin-Users 中发布的答案相似。
标签: gremlin janusgraph amazon-neptune gremlin-server connected-components