Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-10-2020 10:56 PM
hi all:
i'm running label propagation algorithm to detect the community structure. I used the following 3 methods to get the community.however the first one got the wrong result. it partitioned the whole network as one community which is obviously unreasonable. The other two worked correctly and partitioned the network into two communities.
Solved! Go to Solution.
03-14-2020 07:59 AM
You need to return the seed property in the Cypher statement in your first algo call:
CALL. algo.labelPropagation(
'MATCH (a:node) RETURN id(a) as a, a.seed_label as seed_label',
'MATCH (a:node) -[r:FOLLOW)-(b:node) RETURN id(a) as source, id(b) as target',
{graph:'cypher', partitionProperty:'seed_label',write:true, writeProperty:'s1'}
)
Without specifying the seed property value returned from the node query, there's no way for the algorithm to know what values to use.
03-10-2020 11:05 PM
the graph and the commynity detection results are shown here.
03-11-2020 12:25 AM
Hi @xiexiexxs,
Welcome to the Neo4j community!!
Do you have any query in the above post?
03-11-2020 12:29 AM
query? you mean the cypher clauses?
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'}
)
03-11-2020 12:31 AM
Sorry for confusion. What I mean was, do you have any question ?
03-11-2020 12:38 AM
yes, my question is that why the first call procedure(shown in the first figure) got the wrong community(shown in table as s1)? in my view,the three procedures doesn't diff much.
03-14-2020 07:59 AM
You need to return the seed property in the Cypher statement in your first algo call:
CALL. algo.labelPropagation(
'MATCH (a:node) RETURN id(a) as a, a.seed_label as seed_label',
'MATCH (a:node) -[r:FOLLOW)-(b:node) RETURN id(a) as source, id(b) as target',
{graph:'cypher', partitionProperty:'seed_label',write:true, writeProperty:'s1'}
)
Without specifying the seed property value returned from the node query, there's no way for the algorithm to know what values to use.
03-15-2020 08:32 PM
great ! solved my problem perfectly!
I mistakenly thought that the partitionProperty would find the property named 'seed_label' from the the quried node as nodes have a property named 'seed_label' ,without explicitly soecifying it.
thanks a lot!
All the sessions of the conference are now available online