Dear all,
I try to use seedProperty in wcc algo.
My goal is to compile wcc only for a subgraph, in order to reduce time.
Assume that A->B and C->D
After computing wcc algo, i obtain:
ID CLUSTER
A 0
B 0
C 2
D 2
and to rerun the wcc algo only on subgraph with nodes (C and D), but without seedProperty, I obtain
ID CLUSTER
A 0
B 0
C 0
D 0
Of course, it is wrong because A, B,C and D are not in the same component.
To correct this, I add the option "seedProperty", but I have an error.
I obtain a error Failed to invoke procedure gds.wcc.write
: Caused by: java.lang.NullPointerException.
I give you an example.
CREATE (a:LEU{LEID:"A"})
CREATE (b:LEU{LEID:"B"})
CREATE (c:LEU{LEID:"C"})
CREATE (d:LEU{LEID:"D"})
MATCH (parent:LEU {LEID:"A"})
MATCH (child:LEU {LEID:"B"})
MERGE (parent)-[l:REL]->(child)
RETURN parent.LEID, child.LEID
MATCH (parent:LEU {LEID:"C"})
MATCH (child:LEU {LEID:"D"})
MERGE (parent)-[l:REL]->(child)
RETURN parent.LEID, child.LEID
// create graph
CALL gds.graph.create.cypher('graph', 'MATCH (n:LEU) RETURN id(n) AS id',
'MATCH (p:LEU)-[r:REL]->(c:LEU) RETURN id(p) AS source, id(c) AS target')
YIELD graphName, nodeCount, relationshipCount, createMillis
//make wcc
CALL gds.wcc.write('graph', { writeProperty: 'cluster' })
YIELD nodePropertiesWritten, componentCount
//delete graph
CALL gds.graph.drop('graph') YIELD graphName
// display info
MATCH (p:LEU) RETURN p.LEID, p.cluster
// A 0
// B 0
// C 2
// D 2
// Create subgraph
CALL gds.graph.create.cypher('graph', 'MATCH (n:LEU) WHERE n.cluster = 2 RETURN id(n) AS id',
'MATCH (p:LEU)-[r:REL]->(c:LEU) WHERE p.cluster = 2 and c.cluster = 2 RETURN id(p) AS source, id(c) AS target')
YIELD graphName, nodeCount, relationshipCount, createMillis
//make wcc
CALL gds.wcc.write('graph', { writeProperty: 'cluster' })
YIELD nodePropertiesWritten, componentCount
//delete graph
CALL gds.graph.drop('graph') YIELD graphName
//display info
MATCH (p:LEU) RETURN p.LEID, p.cluster
CALL gds.wcc.write('graph', { seedProperty: 'cluster', writeProperty: 'cluster' })
YIELD nodePropertiesWritten, componentCount
If you have any idea, pease help me.
Best regards,
Alexandre