Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Neo4j:从所有最短路径中找到的总路径数?_Neo4j_Cypher - Fatal编程技术网

Neo4j:从所有最短路径中找到的总路径数?

Neo4j:从所有最短路径中找到的总路径数?,neo4j,cypher,Neo4j,Cypher,是否有方法获取在类型的查询中从AllShortestPath找到的路径总数的计数 Match (n:Person{personid:123}), (m:Person{personid:456}), p =allShortestPaths(n-[r*1..6]-m) with reduce(weight = 0, rel in rels(p) | weight + rel.weight) AS weight, n, m,p return n, m, p,weight order by weight

是否有方法获取在类型的查询中从AllShortestPath找到的路径总数的计数

Match (n:Person{personid:123}), (m:Person{personid:456}), p =allShortestPaths(n-[r*1..6]-m) with reduce(weight = 0, rel in rels(p) | weight + rel.weight) AS weight, n, m,p return n, m, p,weight order by weight limit 25
下面是一种方法(通过收集路径,获得集合的长度,然后将集合放回路径行)

下面是一种方法(通过收集路径,获得集合的长度,然后将集合放回路径行)

下面是一种方法(通过收集路径,获得集合的长度,然后将集合放回路径行)

下面是一种方法(通过收集路径,获得集合的长度,然后将集合放回路径行)

MATCH (n:Person { personid:123 }),(m:Person { personid:456 }), p =allShortestPaths(n-[r*1..6]-m)
WITH n, m, COLLECT(p) AS paths
WITH n, m, paths, LENGTH(paths) AS totalPaths
UNWIND paths AS p
RETURN n, m, totalPaths, p, reduce(weight = 0, rel IN rels(p)| weight + rel.weight) AS weight
ORDER BY weight
LIMIT 25