1、遍历数据库中的所有结点 2、根据结点入度和出度设置结点类型
如结点入度>1 出度>1 set node=Type1 怎么计算入度和出度?
match(n:RainStormStateNode)-[:SRelationship]->(m:RainStormStateNode) with count(n) as InDgree,m match(m)-[:SRelationship]->(p:RainStormStateNode) with InDgree,count(p) as OutDgree,m where InDgree>1 and OutDgree>1 set m:MergeSplitNode; 不知是否有更简洁的方法
@wkq278276130 现在是想 数据放到数据库里面了以后,我通过语句来更新一些数据的标签。但是通过上面写的那种方法,一个序列开头和结尾的节点,开头节点只有出度没有入度,结尾节点只有入度没有出度,都是没办法判断出来的。或者有没有别的办法单独判断节点是开头还是结尾的点
match(n:RainStormStateNode) with (n)-[:SRelationship]->() with count(n) as InDgree,n with (n)<-[:SRelationship]-() with InDgree,count§ as OutDgree,n case when InDgree>1 and OutDgree>1 then set n:Node1 when InDgree=0 and OutDgree>1 then set n:Node2 when InDgree>1 and OutDgree=0 then set n:Node3 end ;语法不晓得对不对。试一试