incubator-hugegraph icon indicating copy to clipboard operation
incubator-hugegraph copied to clipboard

查询n度以内关系不返回结果或超时

Open chentianlong1993 opened this issue 5 years ago • 2 comments

需求:查询指定顶点n度以内关系,如,查询某一顶点3度以内所有关系,期望返回1、2、3度关系集合。 语句:g.V('13:00E0A220EEE85167E2CC57F14801903C').repeat(bothE().otherV().simplePath()).emit(loops().is(lte(3))).path().dedup() 结果:返回是十几条数据时正常返回,若需要返回的是5000条以上数据则抛出超时异常。

请问是语句问题还是其他问题呢?若语句有问题,为何少量数据还可以正常返回呢?是否有其他写法能满足这个需求呢?

chentianlong1993 avatar Dec 24 '20 03:12 chentianlong1993

请使用下面语句:

g.V('13:00E0A220EEE85167E2CC57F14801903C')
 .repeat(bothE().otherV().simplePath())
 .until(loops().is(gte(3)))
 .path().dedup()

如果中间有超级点,可以使用local degree limit跳过或者使用local sample采样:

g.V('13:00E0A220EEE85167E2CC57F14801903C')
 .repeat(local(bothE().otherV().simplePath().limit(10)))
 .until(loops().is(gte(3)))
 .path().dedup()

javeme avatar Dec 24 '20 03:12 javeme

感谢回复,close了。

chentianlong1993 avatar Dec 24 '20 06:12 chentianlong1993