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

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

Open
xiexiexxs opened this issue Mar 13, 2020 · 0 comments
Open

Comments

@xiexiexxs
Copy link

xiexiexxs commented Mar 13, 2020

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'}
)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant