Neo4j 中的一对多最短路径查询支持 [英] One-to-Many Shortest Path query support in Neo4j

查看:73
本文介绍了Neo4j 中的一对多最短路径查询支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

neo4j 是否支持一对多最短路径查询?此类查询的一个示例是:给定节点 i 和其他几个节点 N 的列表,计算从 i 到属于 N 的所有节点的最短路径.

Does neo4j have support for one-to-many shortest path queries? An example of such query would be: Given a node i, and a list of several other nodes N, compute the shortest paths from i to all the nodes that belong to N.

我知道这个线程:Neo4j 最短路径 (BFS) 距离查询变体,但它专门用于一对多查询.我的问题是一对多查询.

I am aware of this thread: Neo4j shortest path (BFS) distances query variants, but it is specifically for one-to-all queries. My question is for one-to-many queries.

谢谢.

推荐答案

获取从一个节点到多个节点的所有路径

To get All paths from one node to multiple nodes

MATCH p = shortestPath((s:skill)-[r]->(s1:skill))
WHERE id(s) = 123
AND id(s1) IN [1,2,3]

RETURN p

这是在一对多之间获取路径的一种方法.我希望这是你需要的.

This is the one way to get paths between one-to-many. I hope this is what you need.

这篇关于Neo4j 中的一对多最短路径查询支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆