Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

how to use cypher projection and seedProperty in labelPropagation? #934

@xiexiexxs

Description

@xiexiexxs

hi all,
when using labelPropagation (in neo4j-graph-algorithms-3.5.14.0-standalone),i met a problem . how to use cypher projection and seedProperty in labelPropagation.
here is the example network.

QQ图片20200311135236
i tried 3 methods to do label propagation. the second the third used cypher projection and seedProperty seperately and got right answer.the first used both but get wrong answer,which partition all nodes into one community,showed as following.
QQ图片20200311135230
AAA
all codes are here:

MERGE (nAlice:node {id:'Alice'}) SET nAlice.seed_label=52
MERGE (nBridget:node {id:'Bridget'}) SET nBridget.seed_label=21
MERGE (nDoug:node {id:'Doug'}) SET nDoug.seed_label=21
MERGE (nMark:node {id:'Mark'}) SET nMark.seed_label=19
MERGE (nMichael:node {id:'Michael'}) SET nMichael.seed_label=52
MERGE (nAlice)-[:FOLLOW]->(nBridget)
MERGE (nMark)-[:FOLLOW]->(nDoug)
MERGE (nBridget)-[:FOLLOW]->(nMichael)
MERGE (nDoug)-[:FOLLOW]->(nMark)
MERGE (nMichael)-[:FOLLOW]->(nAlice)
MERGE (nAlice)-[:FOLLOW]->(nMichael)
MERGE (nBridget)-[:FOLLOW]->(nAlice)
MERGE (nMichael)-[:FOLLOW]->(nBridget)

CALL algo.labelPropagation(
    'MATCH (a:node) RETURN id(a) as id',
    'MATCH (a:node)-[r:FOLLOW]-(b:node) RETURN id(a) as source ,id(b) as target',
    {graph:'cypher',iterations:50,partitionProperty:'seed_label',write:true,writeProperty:'s1'}
    )
	
CALL algo.labelPropagation(
    'MATCH (a:node) RETURN id(a) as id',
    'MATCH (a:node)-[r:FOLLOW]-(b:node) RETURN id(a) as source ,id(b) as target',
    {graph:'cypher',iterations:50,write:true,writeProperty:'s2'}
    )
	
CALL algo.labelPropagation('node','FOLLOW',
{iterations:50,partitionProperty:'seed_label',write:true,writeProperty:'s3'}
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions