The relationship 'Appears_in' has the weight property and some articles nodes has seed label property.
I would like to propagate this seed labels to create clusters with the articles that speaks about the same topic, for example (politics cluster). More precisely I would like to propagate seed label to another article node but articles do not have a direct relationship between them. They are 'somewhere' connected through the words that they have in commun...
Is it possible to propagate the label from one article node to another article node through the words' node?
@LJRB you'll want to use a cypher projection to connect articles based on the number of shared words:
CALL gds.labelPropagation.stream(
{
nodeQuery: 'MATCH (a:Article) RETURN id(a) as id',
relationshipQuery: 'MATCH (a1:article)<-[:Appears_in]-(w:word)-[:Appears_in]->(a2:article) RETURN id(a1) as source, id(a2) as target, count(distinct w) as word_weight',
relationshipWeightProperty: 'word_weight'
}
)
This gives you a projected graph where articles are connected based on the words they have in common, and the number of common words is the weight of the connection. When you run LPA, it will propagate labels based on common content across articles.
If you wanted to simply propagate labels irrespective of whether you're using word or article labels, the simplest this is to use a native projection and specify multiple node labels. You don't need to add labels or relationship types in this case -- just specify them in the algorithm call: