查找点11111和点22222之间的最短路径,并且做多扩线6层

方法1
{
“gremlin”: “g.V(11111).repeat(bothE().otherV().simplePath()).until(hasId(22222).or().loops().is(gte(6))).hasId(22222).limit(1).path();”
}

方法2
{
“gremlin”: “g.V(11111).repeat(bothE().otherV().simplePath()).emit().times(6).hasId(22222).limit(1).path();”
}

方法3,如果中间有大节点,会导致超时
{
“gremlin”: “g.V(11111).repeat(choose(both().count().is(lte(1000)),bothE().otherV().simplePath())).emit().times(6).hasId(22222).limit(1).path();”
}

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐