Hi,
I'm trying to project a graph in order to perform a Label Propagation LPA community detection algorithm and am coming up with this error:
Failed to invoke procedure `gds.graph.project.cypher`: Caused by: java.lang.IllegalArgumentException: Failed to load a relationship because its source-node with id 7 is not part of the node query or projection. To ignore the relationship, set the configuration parameter `validateRelationships` to false.
I'm trying to update an older GA syntax but running into difficulties. Here is the original code:
CALL algo.labelPropagation.stream(
'MATCH (p:Publication) RETURN id(p) as id',
'MATCH (p1:Publication)-[r1:HAS_WORD]->(w)<-[r2:HAS_WORD]-(p2:Publication)
WHERE r1.occurrence > 5 AND r2.occurrence > 5
RETURN id(p1) as source, id(p2) as target, count(w) as weight',
{graph:'cypher',write:false, weightProperty : "weight"}) yield nodeId, label
with label, collect(algo.asNode(nodeId)) as nodes where size(nodes) > 2
MERGE (c:PublicationLPACommunity {id : label})
FOREACH (n in nodes |
MERGE (n)-[:IN_LPA_COMMUNITY]->(c)
)
return label, nodes
And the projection code I'm trying looks like this:
CALL gds.graph.project.cypher(
'publicationsAndDocuments',
'MATCH (n) WHERE n:Publication OR n:Document RETURN id(n) AS id, labels(n) AS labels',
'MATCH (n1)-[r1:HAS_WORD]->(w)<-[r2:HAS_WORD]-(n2) RETURN id(n1) AS source, id(n2) AS target', {validateRelationships:TRUE})
YIELD
graphName AS graph, nodeQuery, nodeCount AS nodes, relationshipCount AS rels
It works if I set the validateRelationships to FALSE - but I need these to perform the community detection. I'm not sure if this is correct - or close to correct at this stage. As you can see, I've not yet managed to fit the 'weighting' of or the word occurrences part.
Would be grateful for any help on this matter