Showing results for 
Search instead for 
Did you mean: 

Similarity with properties and weights

Node Link

Hi there,

I'm looking for a way to get the similarity between nodes considering node properties and weights. I've seen the Alicia's response that recommends to use Cosine algorithm but I haven't found a way to make my schema to fit on this model.

My current schema looks like this:

I want to take the similarity order to get the candidates that are most compatible with a specific Job. The properties that I'm considering as match are:

  • Candidate must not be [:RECOMMENDED] to the Job
  • Candidate must have one City related to the Job
  • Candidate must have one Focus related to the Job with the relationship being (Candidate)-[r]-(Focus)--(j:Job) where r.experience = job.experience
  • Candidate must at least one required Tech related to the Job: [:TO_WORK_WITH {required: true}] (every other technology that is not the required should increase the similarity)
  • Candidate has salary property that should match the Job salary property

If the candidate has all the properties from the Job and also some more nodes, it must return the maximum similarity, once all the requirements have been met.

The cypher query that I'm running now is this:

  MATCH (j:Job {id: 1})
  MATCH (c:Candidate)-[r1]-(f:Focus)--(j)
  r1.experience = j.experience AND (c.clt_salary = j.clt_salary OR c.pj_salary = j.pj_salary)
  MATCH (c)--(ci:City)--(j)
  MATCH (c)--(t:Tech)-[{required: true}]-(j)
  MATCH (j)--(n)--(c)

  RETURN AS candidate_id, COUNT(DISTINCT(n))  AS similarity
  ORDER BY similarity DESC

This approach is very slow and I feel like it's just wrong, I would like to use GDS to take the similarity for me.

I know its a very specific use case but I haven't found any solution that works for me, I'd be glad if someone can help me with this.