我想给顶点增加权重。
我在 r-studio 中迈出了第一步。以下代码给出了一个带有权重的数据框:
query = "
MATCH (p)-[:REFERS_TO]->(q)<-[:REFERS_TO]-(r)
WHERE (ID(p) < ID(q))
RETURN q.name, COUNT(q) AS Weight
ORDER BY Weight DESC
"
newvalue = cypher(graph, query)
如何将权重作为标签添加到顶点?以下对我不起作用,因为它将权重添加到节点而不是顶点:
query = "
MATCH (p)-[:REFERS_TO]->(q)<-[:REFERS_TO]-(r)
WITH q.name, COUNT(q) AS Weight
SET q.weight = Weight
"
cypher(graph, query)
谢谢!