GO 1 TO 10 STEPS FROM “host001” OVER * YIELD dst(EDGE) as Destination | FIND ALL PATH FROM “host001” TO $-.Destination OVER * YIELD PATH as p
这样对于OUT方向是可以的,但同时我又想要IN方向,试了用BIDIRECT,但这样的问题是会查出来和vertex有相同tag的点和边
MATCH p=(v)-[*1..10]-(m)
where id(v)=="host001" and all( midNode in [n in nodes(p) where id(n)<>id(v) | n] where "frontPort" not in tags(midNode))
RETURN p
MATCH p=(v)-[*1…10]->(m) WHERE id(v)==“host001” and all( midNode in [n in nodes(p) where id(n)<>id(v) | n] where “host” not in tags(midNode)) RETURN p
UNION
MATCH p=(v)<-[*1…10]-(m) WHERE id(v)==“host001” and all( midNode in [n in nodes(p) where id(n)<>id(v) | n] where “host” not in tags(midNode)) RETURN p
这样写的话似乎where中的第二个条件也可以去掉了直接
MATCH p=(v)-[*1…10]->(m) WHERE id(v)==“host001” RETURN p,StartNode, id(endNode(p)) as EndNode, length(p) as PathLength
UNION
MATCH p=(v)<-[*1…10]-(m) WHERE id(v)==“host001” RETURN p,StartNode, id(endNode(p)) as EndNode, length(p) as PathLength
MATCH p=(n)<-[*1..2]-(v)-[*1..2]->(m)
where id(v)=="host001" and all( midNodeTags in [n in nodes(p) where id(n)<>id(v) | labels(n)] where not "host" in midNodeTags)
with p,length(p) as len return p ,len order by len desc limit 10