Neo4j中标签传播算法的实现
我有一组节点IP地址,它们通过:connected_to相互连接,我想在它们上实现标签传播算法。但在下面的命令下运行后并没有结果Neo4j中标签传播算法的实现,neo4j,Neo4j,我有一组节点IP地址,它们通过:connected_to相互连接,我想在它们上实现标签传播算法。但在下面的命令下运行后并没有结果 CALL algo.labelPropagation('Node','connected_to','OUTGOING'(write:true,partitionProperty:'community',weightProperty:'count')) 有人能帮我吗?如果可以,请使用GDS库。 1.创建命名图。 如果您真的只有:Node标签,那么您可能需要处理这个问题
CALL algo.labelPropagation('Node','connected_to','OUTGOING'(write:true,partitionProperty:'community',weightProperty:'count'))
有人能帮我吗?如果可以,请使用GDS库。
1.创建命名图。
如果您真的只有:Node
标签,那么您可能需要处理这个问题。(:设备?,:网关?等)
2.运行投影
3.如果需要,可以修改图形。
来源:
id(x)
,而是使用任何唯一的节点属性。这涉及到图形设计,因此,TL;DR:唯一
约束和索引
,在这里有很大帮助。因为您知道node.ip
是唯一的,所以您可以使用它来匹配(x:node{ip:ip})
CALL gds.graph.create('projection', '*', '*')
// CALL gds.graph.create('projection', ['Device','Gateway','Node'], 'connected_to')
YIELD graphName, nodeCount, relationshipCount;
CALL gds.labelPropagation.stream('projection')
YIELD nodeId, communityId AS Community
RETURN gds.util.asNode(nodeId).ip AS IP, Community
ORDER BY Community, IP
CALL gds.labelPropagation.stream('projection')
YIELD nodeId, communityId AS Community
WITH gds.util.asNode(nodeId).ip AS IP, Community
MATCH (x:Node {ip: IP})
SET x.community = Community
RETURN Community, count(DISTINCT x)