cancel
Showing results for 
Search instead for 
Did you mean: 

Writing additional properties to relationships created by gds algorithms

zi-nt
Node

As the title suggests, I'm curious as to if it's possible to write additional properties to relationships generated by various algorithms in the data science library. A specific use case: in the following query, a relationship: SIMILAR is generated between two users with a single property: score. I'm interested in also writing an additional date property to that relationship: calculatedAt.

MATCH (p:User)
WHERE NOT (p)-[:SIMILAR]->()
WITH { 
  item: id(p),
  weights: [avg(p.a),avg(p.b),avg(p.c),avg(p.d)]
} AS userData
WITH collect(userData) AS data
CALL gds.alpha.similarity.cosine.write({
  data: data,
  similarityCutoff: 0.0,
  topK: 25
})
YIELD nodes, similarityPairs, writeRelationshipType, writeProperty, min, max, mean, stdDev, p25, p50, p75, p90, p95, p99, p999, p100
RETURN nodes, similarityPairs, writeRelationshipType, writeProperty, min, max, mean, p95

The end goal is to compare calculatedAt to a User property: lastUpdated, and only re-calculate similarity against users who have updated their weights since the last calculatedAt.

0 REPLIES 0