cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

algo.unionFind connected component

depire
Node Clone

Hello All,
I'm a newbie in Neo4j.
I load a csv file (format: id) for the nodes and a csv file (format: id id share) for the relationships.
I look at the connected components but I want to consider only the major relationships (above 50%), so I use the following code:
CALL algo.unionFind.stream('LEU', 'controls', {weightProperty: 'share', threshold:50.1})
YIELD nodeId,setId
MATCH (n:LEU) WHERE id(n) = nodeId
SET n.cluster = setId

I create a property "cluster" in order to store the result.
After I display a certain cluster
MATCH (p:LEU) WHERE p.LEID = "403313330"
MATCH (n:LEU) WHERE n.cluster = p.cluster
RETURN n

I retrieve 9 nodes, perfect, then I click on the "Expand child relationships" menu and there I display a new node linked to one of the former via a relationship having more than 50%, how is it possible ?

Is algo.unionFind the correct algo to serach the connected component ?

I use the Neo4j CE 3.2.1 and Neo4j Browser 3.0.4.

Best regards,
Alexandre

1 REPLY 1

Hi Depire, welcome to Neo4j! When running connected components, if you want to write the results back to the graph, you can skip the .stream part, and specify write:True, writeProperty:'cluster' in your algorithm call.

It should look something like this: `CALL algo.unionFind('LEU', 'controls', {weightProperty: 'share', write:true, writeProperty:'cluster', threshold:50.1})