Can I give a weight to my graph?


(Mehdi Ajroud) #1

Hey everyone ,

I already made clusters in my graph by using this queries :

CALL algo.unionFind(
'match (n) return id(n) as id',
'match (n1:Attributaires)--(n2) return id(n1) as source, id(n2) as target',
{graph:'cypher', write:true, partitionProperty:"clusterId"})
YIELD nodes, setCount, loadMillis, computeMillis, writeMillis;

And then this query to identify my clusters :

match (n1:Attributaires)-[r]-()
with n1.clusterId as clusterId, count(n1) as clusterSize,count(distinct r) as numberOfRels
where clusterSize > 10 AND  numberOfRels > 10
match (n2) where n2.clusterId = clusterId
MERGE (x:Cluster {id: clusterId})
MERGE (n2)-[:IN_CLUSTER]->(x)

Now I want to know the exact number of relation between each node in my clusters .
Can I apply this method after making clusters ? https://neo4j.com/docs/graph-algorithms/current/algorithms/connected-components/#_weighted_version

Or shall I apply the weight before making clusters ?