参考:https://www.galaxybase.com/document?file=v3.4.1%2Fstandalone-doc&docid=15
以下默认:n为点;r为边;p为路径
这里讲的是 在MATCH中的
进行限制或绑定到变量,绑定到变量 可用于后续计算
若要在后续使用,直接 用变量名 即可
(n:Man {name:'hahaha',age:20})
(n)
(:Man)
({name:'hahaha',age:20})
(n:Man {name:'hahaha',age:20})
-[r::BELONG {year:'2000'} ]-
# 最基础表示,不绑定名字,[不考虑方向,右点指向左点,指向右点]
--
<--
-->
# 加`[]`,里面不放东西,加了等于没加
-[]-
# 给这条边命名,方便后续使用
-[r]-
# 给这条边加上一些限制m,[类型,属性,类型+属性]
-[:BELONG]-
-[ {year:'2000'} ]-
-[:BELONG {year:'2000'} ]-
# 支持两种类型
-[:BELONG|MANAGE]-
# 同时 命名+限制(类型+属性)
-[r::BELONG {year:'2000'} ]-
可限制 最小长度与最大长度,不限制最大长度时 很危险
-[*1..3]-
-[:BELONG *1..3]-
-[:BELONG *1..]-
-[:BELONG *..3]-
-[:BELONG *..]-
(n)
(n)-[r]->(n)
(n)-[r]->(n)-[r]->(n)
(n)-[r]->(n)<-[r]-(n)
UNION
除外[OPTIONAL] MATCH [p=]路径
WHERE 筛选条件
WITH 变量1,变量2
ORDER BY 变量1,变量2
SKIP 4
LIMIT 6
RETURN p
MERGE
UNION [ALL]
OPTIONAL MATCH:对未匹配到的位置,填入null
p=路径匹配规则:把获取到的路径放到p中
SKIP LIMIT
配合使用:选择第5-10个
UNION ALL:不进行去重,直接拼接
CREATE
DELETE n
DELETE r
DETACH DELETE
SET r.name='hahaha'
REMOVE n.name
REMOVE n:Man
REMOVE n:Man:Chinese
LOAD CSV FROM 'https://www.chuanglintech.com/public/company.csv' AS line
CALL … YIELD …
UNWIND
EXIST
IS NULL
IS NOT NULL
UNIQUE
INDEX
STARTS WITH
ENDS WITH
CONTAINS
DISTINCT
AS
OR
AND
NOT
USING [INDEX [SEEK] | SCAN ] variable:Label(property)
FOREACH <设值操作>
ALLOWREPEAT DIRECTED
CREATE INDEX ON :label(key…)
DROP INDEX ON :label(key…)
allShortestPaths()
id()
apoc.custom.declareProcedure
官方文档:https://neo4j.com/docs/graph-data-science/current/
函数 | 作用 | 链接 |
---|---|---|
gds.graph.list | 列出所有映射; 这不是一个快照,原图新增了符合的节点,在使用的时候也会出现 |
https://neo4j.com/docs/graph-data-science/current/graph-list/ |
gds.graph.project | 创建 映射(临时图,用完需手动删除) | https://neo4j.com/docs/graph-data-science/current/graph-project/ |
gds.util.asNode | 从ID转换为node | |
gds.graph.drop | 删除映射 | https://neo4j.com/docs/graph-data-science/current/graph-drop/ |
并不是都有CALL调用
# gds.graph.list
CALL gds.graph.list()
# gds.graph.project
CALL gds.graph.project('friends','person','friend')
# gds.util.asNode:
CALL gds.pageRank.stream('friends')
YIELD nodeId
WITH gds.util.asNode(nodeId) AS n
RETURN n
^等价
CALL gds.pageRank.stream('friends')
YIELD nodeId
RETURN gds.util.asNode(nodeId) AS n
# gds.graph.drop
CALL gds.graph.drop('friends')
使用方式
CALL gds.labelPropagation.stats(xx)
CALL gds.labelPropagation.write(xx)
CALL gds.labelPropagation.mutate(xx)
CALL gds.labelPropagation.stream(xx)
execution mode
https://neo4j.com/docs/graph-data-science/current/common-usage/running-algos/
https://neo4j.com/docs/graph-data-science/current/algorithms/syntax/
四种