neo4j - 将多个 apoc.path.expand 调用合二为一
问题描述
我有几个密码调用,它们返回连接到我的节点的特定类型(或)的A
节B
点数C
MATCH (n {{ID:"{id}"}})
call apoc.path.expand(n, "<", ">A", 1, 10) yield path as p
return count(distinct nodes(p)[-1])
MATCH (n {{ID:"{id}"}})
call apoc.path.expand(n, "<", ">B", 1, 10) yield path as p
return count(distinct nodes(p)[-1])
MATCH (n {{ID:"{id}"}})
call apoc.path.expand(n, "<", ">C", 1, 10) yield path as p
return count(distinct nodes(p)[-1])
打这些电话 3 次是浪费的,我想知道我是否可以将它们合并为一个,但仍然可以获得所有三个的不同计数
解决方案
这样的事情可以为您完成吗?
MATCH (n {{ID:"{id}"}})
CALL apoc.path.expand(n, "<", ">A,>B,>C", 1, 10) yield path as p
RETURN labels(last(nodes(p)))[0] AS label, count(distinct nodes(p)[-1])
推荐阅读
- javascript - Filereader 上传多个文件时出错
- azure-data-studio - Azure Data Studio:如何保存笔记本。还有,怎么改名
- python - 装饰函数的参数如何工作?
- typescript - 打字稿动态分配类属性
- python - 如何使用源映射解析 HTML?
- wordpress - 将小计添加到结帐按钮
- azerothcore - 如何在 Keira3 中设置 61 个 LINK 触发 SmartAI 之间的时间?
- algorithm - 最短路径和 Dijkstra 的最优子结构
- javascript - 从 javascript 传递到 Avada wordpress php
- css - 在 React 项目中无法识别 minmax CSS 函数