在查询之间的neo4j
<td #x ng-mouseover="x.isHover=true" ng-mouseleave="x.isHover=false">{{user.Name}}
<example-popover *ngIf="x.isHover"></example-popover>
</td>
和
MATCH (a), (b)
WHERE a<>b
WITH length(shortestPath((a)-[]->(b))) AS dist, a, b
RETURN DISTINCT sum(1.0/dist) AS closeness, a
ORDER BY closeness DESC
没有区别。那是MATCH (a), (b)
WHERE a<>b
WITH length(shortestPath((a)-[]->(b))) AS dist, a, b
RETURN DISTINCT sum(dist) AS closeness, a
ORDER BY closeness DESC
无效。
图表
1.0/dist
两个查询都会返回一个答案:
CREATE (A {name: "A"})
CREATE (B {name: "B"})
CREATE (C {name: "C"})
CREATE (D {name: "D"})
CREATE (E {name: "E"})
CREATE (A)-[:TO]->(E)
CREATE (A)-[:TO]->(B)
CREATE (B)-[:TO]->(C)
CREATE (B)-[:TO]->(E)
CREATE (C)-[:TO]->(D)
CREATE (E)-[:TO]->(D)
CREATE (D)-[:TO]->(B)
我想弄明白为什么。
答案 0 :(得分:0)
如果您尝试仅打印dist
值:
MATCH (a), (b)
WHERE a<>b
WITH length(shortestPath((a)-[]->(b))) AS dist, a, b
RETURN dist
返回:
dist
1
null
null
1
null
1
null
1
null
null
1
null
null
1
null
null
null
null
null
1
因此,dist
和1.0/dist
之间没有区别。运营商/
有效,只需尝试返回2.0/dist
,您就会看到预期结果。希望有所帮助。