TuGraph安装与简单使用

TuGraph安装与简单使用

TuGraph

TuGraph 是蚂蚁集团自主研发的大规模图计算系统,提供图数据库引擎和图分析引擎。其主要特点是大数据量存储和计算,高吞吐率,以及灵活的 API,同时支持高效的在线事务处理(OLTP)和在线分析处理(OLAP)。 LightGraph、GeaGraph 是 TuGraph 的曾用名。

一、安装

1. 安装docker

安装docker

2. 拉取TuGraph镜像

https://hub.docker.com/search?q=tugraph
在这里插入图片描述

docker pull tugraph/tugraph-db-centos7

3. 启动docker

docker run -d -p 7070:7070 -p 9090:9090 --name tugraph_demo tugraph/tugraph-db-centos7 lgraph_server
# 7070是默认的http端口,web访问使用。
# 9090是默认的rpc端口,rpc client访问使用。

4. 访问web端

在浏览器内输入,默认用户名为admin,密码为73@TuGraph

localhost:7070

在这里插入图片描述

登录控制台之后可以点击左侧帮助查看相关文档

在这里插入图片描述

二、数据类型

TuGraph 支持多种可用作属性的数据类型,具体支持的数据类型如下所示:

数据类型最小值最大值描述
BOOLfalsetrue布尔值
INT8-1281278-bit 整型
INT16-327683276716-bit 整型
INT32- 2^312^31 - 132-bit 整型
INT64- 2^632^63 - 164-bit 整型
DATE0000-00-009999-12-31“YYYY-MM-DD” 格式的日期
DATETIME0000-00-00 00:00:009999-12-31 23:59:59"YYYY-MM-DD hh:mm:ss"格式的时间日期
FLOAT32-bit 浮点数
DOUBLE64-bit 浮点数
STRING长度不定的字符串
BLOB二进制数据

三、图基础

TuGraph采用属性图模型。图模型是对事物及其关联关系的建模,由

  • 顶点(vertices/nodes)
  • 边(edges/relationships)
  • 属性(property)

​ 组成,接下来看一下文档里的示例yago

在这里插入图片描述

yago数据共包含5种顶点,8种边,共同描述电影和演员的基本关系,以及用户对电影的评分。

标签类型说明
movie实体表示某一部具体的影片,比如"阿甘正传"。
person实体表示个人,对影片来说可能是演员、导演,或编剧。
genre实体表示影片的类型,比如剧情片、恐怖片。
keyword实体表示与影片相关的一些关键字,比如"拯救世界"、“虚拟现实”、“地铁”。
user实体表示观影的用户。
produce关系表示影片的出品人关系。
acted_in关系表示演员出演了哪些影片。
direct关系表示影片的导演是谁。
write关系表示影片的编剧关系。
has_genre关系表示影片的类型分类。
has_keyword关系表示影片的一些关键字,即更细分类的标签。
rate关系表示用户对影片的打分。

四、建模

在建模页面中,左侧蓝色部分表示点的模型,右侧绿色部分表示边的模型。一级子节点是模型的名称,二级子节点是模型的属性,三级子节点是这个属性的信息:是否可空,和他的数据类型。
右上角可以搜索模型的名称或者属性,页面中会用红色高亮显示。
创建顶点模型,点击添加,选择对应的数据类型,是否可空默认是否,设置主键,创建成功之后页面中就会显示出来。
创建边的模型,不需要设置主键,也可以不添加任何属性。

4.1 新建子图

在这里插入图片描述

4.2 顶点标签

person

在这里插入图片描述

movie

在这里插入图片描述

4.3 关系标签

produce

在这里插入图片描述

五、数据导入

在导入页面,我们可以上传csv文件在线导入数据,点击选择文件从电脑中选择csv 文件,之后我们先要进行映射数据的操作,首先选择对应的模型(选择movie),点击映射数据,上面的表格是数据模型的属性、数据类型、是否选填。

TuGraph支持从 CSV 文件和 JSON 数据源导入数据。

movie.csv
LABEL=movie
id:INT32:ID,title:STRING,tagline:STRING,summary:STRING:OPTIONAL,poster_image:STRING:OPTIONAL,duration:INT32,rated:STRING:OPTIONAL
1,The Matrix,Welcome to the Real World.,Thomas A. Anderson is a man living two lives. By day he is an average computer programmer and by night a malevolent hacker known as Neo who finds himself targeted by the police when he is contacted by Morpheus a legendary computer hacker who reveals the shocking truth about our reality.,http://image.tmdb.org/t/p/w185/gynBNzwyaHKtXqlEKKLioNkjKgN.jpg,136,R
28,The Matrix Reloaded,Free your mind.,Six months after the events depicted in The Matrix Neo has proved to be a good omen for the free humans as more and more humans are being freed from the matrix and brought to Zion the one and only stronghold of the Resistance. Neo himself has discovered his superpowers including super speed ability to see the codes of the things inside the matrix and a certain degree of pre-cognition. But a nasty piece of news hits the human resistance: 250000 machine sentinels are digging to Zion and would reach them in 72 hours. As Zion prepares for the ultimate war Neo Morpheus and Trinity are advised by the Oracle to find the Keymaker who would help them reach the Source. Meanwhile Neo's recurrent dreams depicting Trinity's death have got him worried and as if it was not enough Agent Smith has somehow escaped deletion has become more powerful than before and has fixed Neo as his next target.,http://image.tmdb.org/t/p/w185/ezIurBz2fdUc68d98Fp9dRf5ihv.jpg,138,R
68,The Matrix Revolutions,Everything that has a beginning has an end.,The human city of Zion defends itself against the massive invasion of the machines as Neo fights to end the war at another front while also opposing the rogue Agent Smith.,http://image.tmdb.org/t/p/w185/sKogjhfs5q3azmpW7DFKKAeLEG8.jpg,129,R
82,Pulp Fiction,Just because you are a character doesn't mean you have character.,placeholder text,http://image.tmdb.org/t/p/w185/dM2w364MScsjFf8pfMbaWUcWrR.jpg,154,R
130,Cloud Atlas,Everything is Connected,placeholder text,http://image.tmdb.org/t/p/w185/k9gWDjfXM80iXQLuMvPlZgSFJgR.jpg,172,R
457,The Shawshank Redemption,Fear can hold you prisoner. Hope can set you free.,placeholder text,http://image.tmdb.org/t/p/w185/9O7gLzmreU0nGkIB6K3BsJbzvNv.jpg,142,R
471,The Godfather,An offer you can't refuse.,placeholder text,http://image.tmdb.org/t/p/w185/d4KNaTrltq6bpkFS01pYtyXa09m.jpg,175,R
496,The Godfather: Part II,I don't feel I have to wipe everybody out\ Tom. Just my enemies.,placeholder text,http://image.tmdb.org/t/p/w185/tHbMIIF51rguMNSastqoQwR0sBs.jpg,200,R
517,The Good\ the Bad and the Ugly,For three men the Civil War wasn't hell. It was practice.,placeholder text,http://image.tmdb.org/t/p/w185/8PD1dgf0kQHtRawoSxp1jFemI1q.jpg,161,R
532,The Dark Knight,Why So Serious?,placeholder text,http://image.tmdb.org/t/p/w185/1hRoyzDtpgMU7Dz4JF22RANzQO7.jpg,152,PG-13
564,The Dark Knight Rises,The Legend Ends,placeholder text,http://image.tmdb.org/t/p/w185/dEYnvnUfXrqvqeRSqvIEtmzhoA8.jpg,165,PG-13
598,Schindler's List,Whoever saves one life\ saves the world entire.,placeholder text,http://image.tmdb.org/t/p/w185/tvOvW7Qjj63zbQW5TZ8CjPThAUd.jpg,195,R
615,12 Angry Men,Life is in their hands. Death is on their minds.,placeholder text,http://image.tmdb.org/t/p/w185/wvlFtIwh0GIqHRAz9F5cCch2IJD.jpg,96,NR
641,The Lord of the Rings: The Return of the King,The eye of the enemy is moving.,Aragorn is revealed as the heir to the ancient kings as he Gandalf and the other members of the broken fellowship struggle to save Gondor from Sauron's forces. Meanwhile Frodo and Sam bring the ring closer to the heart of Mordor the dark lord's realm.,http://image.tmdb.org/t/p/w185/50LoR9gJhbWZ5PpoHgi8MNTYgzd.jpg,201,PG-13
681,Fight Club,How much can you know about yourself if you've never been in a fight?,placeholder text,http://image.tmdb.org/t/p/w185/2lECpi35Hnbpa4y46JX0aY3AWTy.jpg,139,R
698,The Lord of the Rings: The Fellowship of the Ring,One ring to rule them all,Young hobbit Frodo Baggins after inheriting a mysterious ring from his uncle Bilbo must leave his home in order to keep it from falling into the hands of its evil creator. Along the way a fellowship is formed to protect the ringbearer and make sure that the ring arrives at its final destination: Mt. Doom the only place where it can be destroyed.,http://image.tmdb.org/t/p/w185/9HG6pINW1KoFTAKY3LdybkoOKAm.jpg,178,PG-13
710,Star Wars: Episode V - The Empire Strikes Back,The Adventure Continues...,placeholder text,http://image.tmdb.org/t/p/w185/6u1fYtxG5eqjhtCPDx04pJphQRW.jpg,124,PG
737,Inception,Your mind is the scene of the crime.,placeholder text,http://image.tmdb.org/t/p/w185/tAXARVreJnWfoANIHASmgYk4SB0.jpg,148,PG-13
750,One Flew Over the Cuckoo's Nest,If he's crazy\ what does that make you?,placeholder text,http://image.tmdb.org/t/p/w185/srr59GKJdDXPwnWlew9NoYfOvYV.jpg,133,R
770,Forrest Gump,The world will never be the same\ once you've seen it through the eyes of Forrest Gump.,A man with a low IQ has accomplished great things in his life and been present during significant historic events - in each case far exceeding what anyone imagined he could do. Yet despite all the things he has attained his one true love eludes him. 'Forrest Gump' is the story of a man who rose above his challenges and who proved that determination courage and love are more important than ability.,http://image.tmdb.org/t/p/w185/z4ROnCrL77ZMzT0MsNXY5j25wS2.jpg,142,PG-13
781,Goodfellas,Three Decades of Life in the Mafia.,placeholder text,http://image.tmdb.org/t/p/w185/pwpGfTImTGifEGgLb3s6LRPd4I6.jpg,146,R
797,The Lord of the Rings: The Two Towers,A New Power Is Rising.,Frodo and Sam are trekking to Mordor to destroy the One Ring of Power while Gimli Legolas and Aragorn search for the orc-captured Merry and Pippin. All along nefarious wizard Saruman awaits the Fellowship members at the Orthanc Tower in Isengard.,http://image.tmdb.org/t/p/w185/9mBjBuUmBBgnGjV1JZ2uCIYbaph.jpg,179,PG-13
805,Star Wars: Episode IV - A New Hope,A long time ago in a galaxy far\ far away...,Princess Leia is captured and held hostage by the evil Imperial forces in their effort to take over the galactic Empire. Venturesome Luke Skywalker and dashing captain Han Solo team together with the loveable robot duo R2-D2 and C-3PO to rescue the beautiful princess and restore peace and justice in the Empire.,http://image.tmdb.org/t/p/w185/tvSlBzAdRE29bZe5yYWrJ2ds137.jpg,121,PG
1096,3 Days to Kill,amazing killing time,placeholder text,http://image.tmdb.org/t/p/w185/53pam1GAosXwOjefCEVNjYTvy6j.jpg,113,PG-13
1097,300: Rise of an Empire,Amazing killing time,placeholder text,http://image.tmdb.org/t/p/w185/hrOMW22FV86te7uLyRnp3Z6Nv6e.jpg,0,R
1118,American Hustle,Everyone Hustles To Survive,placeholder text,http://image.tmdb.org/t/p/w185/mhB7C62lSMpGO2HYNaW6d7W3TVH.jpg,138,R
1241,Frozen,Amazing killing time,placeholder text,http://image.tmdb.org/t/p/w185/qb4ls8KzTJMFPEwNOfM7FotfC4Y.jpg,102,PG
1293,Gravity,Don't Let Go,placeholder text,http://image.tmdb.org/t/p/w185/2gPjLWIyrWlAn2DgKMOKTBnZYyO.jpg,91,PG-13
1356,The Monuments Men,It was the greatest art heist in history,placeholder text,http://image.tmdb.org/t/p/w185/lhCUqVEPA3MMxnV8QTeVBTmRrP4.jpg,118,PG-13
1366,The LEGO Movie,Assembling in 2014,placeholder text,http://image.tmdb.org/t/p/w185/lMHbadNmznKs5vgBAkHxKGHulOa.jpg,100,PG
1412,RoboCop,We've got the future under control.,placeholder text,http://image.tmdb.org/t/p/w185/hFQcC5eSSHqJfk70RdgrMMxGuYt.jpg,102,PG-13
1550,Her,Amazing killing time,placeholder text,http://image.tmdb.org/t/p/w185/8f8Hisd36IN8jN1OpKxsxRu8i57.jpg,126,R
1596,Dallas Buyers Club,Dare to Live,placeholder text,http://image.tmdb.org/t/p/w185/ecb5z7VGKjfSQLPMwt1FOiPE5V0.jpg,117,R
1693,12 Years a Slave,The extraordinary true story of Solomon Northup,placeholder text,http://image.tmdb.org/t/p/w185/kb3X943WMIJYVg4SOAyK0pmWL5D.jpg,134,R
1768,Elysium,Amazing killing time,placeholder text,http://image.tmdb.org/t/p/w185/tHkjoAxmhp3Eau1h0Ir7maKMwUz.jpg,109,R
1856,Epic,Discover a world beyond your imagination,placeholder text,http://image.tmdb.org/t/p/w185/fdXA81BOdZ3pEyBlY8UUvuJj136.jpg,102,PG
1935,The Croods,Meet the first modern family.,placeholder text,http://image.tmdb.org/t/p/w185/mo4WQxBxs6IU7fmkIOyMOLyG3qq.jpg,98,PG
2008,Mr. Peabody & Sherman,Amazing killing time,placeholder text,http://image.tmdb.org/t/p/w185/qnmYfaopf7xJwLgVjeTdgZ4nI0v.jpg,92,PG
2055,The Avengers,Some assembly required.,placeholder text,http://image.tmdb.org/t/p/w185/cezWGskPY5x7GaglTTRN4Fugfb8.jpg,143,PG-13
2232,Hansel & Gretel: Witch Hunters,Classic tale. New twist.,placeholder text,http://image.tmdb.org/t/p/w185/yDIVWFJqFLIeS8E1R6GG9uwPMS3.jpg,88,R
2398,The Lorax,Meet The Original Force Of Nature,placeholder text,http://image.tmdb.org/t/p/w185/6FuYtjegxaUv7n7C733hUEOQytR.jpg,86,PG
2422,Mulan,This time\ the princess saves the prince.,placeholder text,http://image.tmdb.org/t/p/w185/ztD0iLfeyESQZV95GwPeSE3Uyqn.jpg,88,G
2498,Beowulf,Evil breeds pain.,placeholder text,http://image.tmdb.org/t/p/w185/j90lLkvlcPNL6VVoLGQ0yzPUfJV.jpg,115,PG-13
2654,Solomon Kane,Fight evil... With evil.,placeholder text,http://image.tmdb.org/t/p/w185/n5SHBE4ulsDDVa9gYttUYwp1VZU.jpg,104,R
2767,The Usual Suspects,Five Criminals . One Line Up . No Coincidence.,placeholder text,http://image.tmdb.org/t/p/w185/jgJoRWltoS17nD5MAQ1yK2Ztefw.jpg,106,R
2885,Hugo,One of the most legendary directors of our time takes you on an extraordinary adventure.,placeholder text,http://image.tmdb.org/t/p/w185/fkeaJr29ypea1n24gzspsc7qK44.jpg,126,PG
3106,Fargo,A lot can happen in the middle of nowhere.,placeholder text,http://image.tmdb.org/t/p/w185/aZeX4XNSqa08TdMHRB1gDLO6GOi.jpg,98,R
3252,The Silence of the Lambs,To enter the mind of a killer she must challenge the mind of a madman.,placeholder text,http://image.tmdb.org/t/p/w185/qjAyTj2BSth1EQ89vNfo0JYVPFN.jpg,118,R
3390,The King's Speech,Find your voice.,placeholder text,http://image.tmdb.org/t/p/w185/v8M5Sytbut7vBXyZ1HDy8lUVVcB.jpg,118,R
3459,There Will Be Blood,There Will Be Greed. There Will Be Vengeance.,placeholder text,http://image.tmdb.org/t/p/w185/bFgqkuAFBHNuq0oTtewHwuLVWSO.jpg,158,R
3624,The Iron Lady,Never compromise,placeholder text,http://image.tmdb.org/t/p/w185/e67tal4u66eFz8yGnJGTO5FYRxY.jpg,105,PG-13
3680,The Untouchables,What are you prepared to do?,placeholder text,http://image.tmdb.org/t/p/w185/nv7FOs90Y3Cq5tBhEITEV8Zebyw.jpg,119,R
3753,Capote,In Cold Blood,placeholder text,http://image.tmdb.org/t/p/w185/bf3nxeLglBvXH5jAnMLmhc56muB.jpg,114,R
3915,Lost in Translation,Everyone wants to be found.,placeholder text,http://image.tmdb.org/t/p/w185/5T8VvuFTdaawKLJk34i69Utaw7o.jpg,102,R
movie.json
[3680,"The Untouchables","What are you prepared to do?","placeholder text","http://image.tmdb.org/t/p/w185/nv7FOs90Y3Cq5tBhEITEV8Zebyw.jpg",119,"R"]
[3753,"Capote","In Cold Blood","placeholder text","http://image.tmdb.org/t/p/w185/bf3nxeLglBvXH5jAnMLmhc56muB.jpg",114,"R"]
[3915,"Lost in Translation","Everyone wants to be found.","placeholder text","http://image.tmdb.org/t/p/w185/5T8VvuFTdaawKLJk34i69Utaw7o.jpg",102,"R"]

在这里插入图片描述

接下来我们映射person的数据,选择person的模型,点击映射数据,连线匹配,如果连线错误,可以选中这条线,点击删除线,重新连接,点击导入,导入成功。

person.csv(数据比较多,放在另一篇文章里)

在这里插入图片描述

接下来我们映射边的数据,边的数据需要选择起点的挂载和终点的挂载,起点的挂载我们选择person的id,选择完之后表格会对应生成,终点的挂载选择movie的id,之后连接数据,点击确定,点击导入,导入数据成功。

produce.csv
13,130
14,130
15,1
15,28
15,68
106,82
108,2498
109,82
145,130
490,3915
491,496
491,3915
549,737
549,532
549,564
607,598
609,598
616,615
664,641
664,698
664,797
665,641
665,698
665,797
665,3390
666,641
666,698
666,797
666,3390
683,1693
725,710
725,805
728,710
728,805
764,750
776,2498
791,2885
793,781
1119,1118
1253,1241
1295,1356
1297,1293
1298,1293
1365,1356
1371,2232
1557,1550
1705,1693
1767,1768
2021,2008
2068,2055
2074,2055
2075,2055
2243,2232
2244,2232
2779,2767
2895,2885
3113,3106
3392,3390
3464,3459
3689,3680

在这里插入图片描述

六、数据查询

TuGraph使用Cypher语言进行查询。

6.1 什么是Cypher

Cypher是一种声明式图查询语言,表达高效查询和更新图数据库。Cypher是相对简单的查询语法,它让我们更关注业务领域问题。

Cypher语言的关键字不区分大小写,但是属性值,标签,关系类型和变量是区分大小写的。

Neo4j中不存在表的概念,只有标签(labels),节点(Node),关联(Relation),路径(path),标签里存的节点,节点和关系可以简单理解为图里面的点和边,路径是用节点和关系表示的如:(a)-[r]->(b),表示一条从节点a经关系r到节点b的路径。

在数据查询中,节点一般用小括号(),关联用中括号[]。

6.2 节点和关系

Cypher 采用一对圆括号 () 来表示节点,如 (n:角色) 表示一个 角色 节点,n 是变量名,供命令执行时用 n 来访问这个节点,在命令执行完毕后就无法使用了。同时单独的 () 表示一个匿名节点,在匹配时表示匹配所有节点。

在关系中

  • –表示无方向的关系
  • –> 表示有方向的关系
  • -[r]-> 则给关系赋予一个变量名,方便对这个关系进行操作
  • -[r:配偶]-> 匹配关系为 配偶 的类型

6.3 匹配语句

Neo4j 中,MATCH 命令用于从数据库中获取节点,关系的信息,类似于 SQL 中的 SELECTRETURN 则是在 MATCH 搜索完成后返回数据,因此 MATCH 必须与 RETURN 同时使用。

6.2.1 根据标签匹配节点
// 匹配所有 xx节点
match (n:xx) return n

例如:匹配所有的person

match (n:person) return n

在这里插入图片描述

6.2.2 根据标签和属性匹配节点
// 匹配 property 为 yy 的 xx 节点
match (n:xx{property:'yy'}) return n

例如:匹配nameMartin Scorseseperson节点

match (n:person{name:'Martin Scorsese'}) return n

在这里插入图片描述

6.2.3 匹配任意关系
// 匹配出有任意关系的两个节点
match p = (n)-[r]->(m) return p

在这里插入图片描述

6.2.3 可选匹配

optional match 类似于 match,不同之处在于 optional match 在匹配不到内容时返回 null 方便查询继续进行,而 match 直接返回查询无结果

例如:查找电影The Lord of the Rings: The Return of the King的所有关系

optional match p = (n)-[r]->(m:movie{title:'The Lord of the Rings: The Return of the King'}) return p

在这里插入图片描述

例如:查找user的所有节点

optional match (n: user) return n

在这里插入图片描述

6.2.4 过滤匹配

就像 SQL 一样, Neo4j 中提供 WHERE 子句来过滤 MATCH 的查询结果

例如:查询Perter Jackson制作过哪些电影

MATCH (n:person)-[r:produce]->(m:movie) where n.name='Peter Jackson' return m.title

在这里插入图片描述

同时 WHERE 可以结合函数 exists() ,字符串匹配 starts with,ends with,contains,逻辑匹配 in,not,and,or 和正则表达式匹配进行更加精细的匹配

例如:匹配所有包含duration属性的节点

MATCH (n) where exists (n.duration) return n

在这里插入图片描述

例如:匹配《魔戒》系列的所有作品

MATCH (n:movie) where n.title starts with "The Lord of the Rings" return n.title

在这里插入图片描述

此外还有

// 匹配所有 与 person1 和 person2 有关的节点,同时过滤掉 person3 和 person4
match p=(n)--(m) where  n.name in ['person1','person2'] and not m.name in ['person3','person4'] return p
// 匹配所有 name 包含 x 的节点
// 这个正则表达式等价为 match(n) where n.name contains 'x' return n
match (n) where n.name =~ '.+?x.+' return n

七、数据创建/更新

7.1 创建节点

CREATE 创建单个节点语法如下:

CREATE (
    <node-name>:<lable-name>
    {
        <Property1-name>:<Property1-value>
        ......
        <Propertyn-name>:<Propertyn-value>:
    }
)

例如:创建一个James Wanperson节点

create (n:person{name:'James Wan',id:10000,born:1977})

匹配一下这个被创建的节点

MATCH (n:person{name:'James Wan'}) return n

在这里插入图片描述

然后再创建一个Fast & Furious 7movie节点

create (n:movie{title:'Fast & Furious 7',id:10001})

7.2 创建关系

例如:创建一个James Wan制作Fast & Furious 7的关系

MATCH (n:person),(m:movie) WHERE n.name = 'James Wan' AND m.title = 'Fast & Furious 7' CREATE (n) -[r:produce]-> (m) RETURN r

在这里插入图片描述

7.3 更新数据

例如:给James Wan添加一张照片

MATCH (n:person{name:'James Wan'}) set n.poster_image = 'this is an image' RETURN n

在这里插入图片描述

八、删除

Neo4j 中有两种删除方法,DELETEREMOVEDELETE用于删除节点和关系,REMOVE 用于删除节点和关系的标签与属性。两者都需要配合 MATCH ,先匹配到内容,再执行操作

8.1 删除属性

例如:把James Wan的照片删除

MATCH (n:person{name:'James Wan'}) REMOVE n.poster_image RETURN n

在这里插入图片描述

8.2 删除节点和边

若要删除节点,则需要删除与节点相关的所有边,这与图论一致——不存在没有节点的边。 因此要删掉金轮法王这个节点,就先需要找到该节点和所在关系,再进行删除

例如:要删除James Wan,需要同时删除该节点以及与之相关的所有的边

MATCH (n:person{name:'James Wan'}) -[r]- () DELETE n,r

在这里插入图片描述

8.3 清空数据库

清空数据库,意味着要清空所有的节点节点存在两种情况:有边连接的和孤立的节点,因此需要同时匹配这两种情况,再进行删除

MATCH (n) -[r]- () DELETE n,r

这里就不演示了…

  • 19
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值