cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

Nodes A and B more interconnected

guille_rr
Node Link

Hi all,

we need to obtain, among all the nodes (A and B), the two nodes that are most related to each other.
Starting from the following scheme:

guille_rr_4-1670243325777.png

I am using this cypher, but logically it never ends: (j is green, c is pink)

guille_rr_3-1670242466591.png

Could I use another cypher or would I have to use apoc similarity, gds.nodeSimilarity?

Thanks !

regards

1 ACCEPTED SOLUTION

ameyasoft
Graph Maven
Try this:
match (a:Job)-[]-(b:Requirements)
//assuming b has a property, 'require'.....also a has property,'jobID'....
with a.jobID as jobID, collect(b.require) as rq1

match (c:Candidate)-[]-(d:Requirements)
//Assuming c has a property 'candidateID'........
with jobID, rq1, c.candidateID as cndID, collect(d.require) as crq1
with jobID, cndID, apoc.coll.intersection(rq1, crq1) as cmn
with jobID, cndID, cmn, size(cmn) as cnt
return jobID, cndID, com, cnt order by cnt desc

View solution in original post

4 REPLIES 4

pohoriljakv
Node Link

Hi,

My opinion is that in world where set of parameters is small and finite is easier to use relational databases (or small source code, or XML et. ). I have visited presentation of great Mark Needham, where he presented football teams, football players and database of results and statistics in graph database. It was ˇPLUS from marketing point of view, but MINUS from architecture point of view. I would analyze jobs, candidates and their matches out of graphs, but do not take my advice too seriously.

Regards

Vaclav

ameyasoft
Graph Maven
Try this:
match (a:Job)-[]-(b:Requirements)
//assuming b has a property, 'require'.....also a has property,'jobID'....
with a.jobID as jobID, collect(b.require) as rq1

match (c:Candidate)-[]-(d:Requirements)
//Assuming c has a property 'candidateID'........
with jobID, rq1, c.candidateID as cndID, collect(d.require) as crq1
with jobID, cndID, apoc.coll.intersection(rq1, crq1) as cmn
with jobID, cndID, cmn, size(cmn) as cnt
return jobID, cndID, com, cnt order by cnt desc

guille_rr
Node Link

Thanks, it works

guille_rr
Node Link

And can I get similarity between these A (Candidate) and  B (Job) nodes, base on the edge with Skills ?

guille_rr_0-1670970697200.png

I have create these proyect:

CALL gds.graph.project(
  'test3',                     
  ['Job', 'Candidate', 'Skill'],                       
  {                                         
    HAS_COMPETENCY: { properties: "experience_years" },
    IS_REQUIRED: { properties: "experience_years" }   
  }
)
YIELD
  graphName AS graph,
  relationshipProjection AS nodesProyection,
  nodeCount AS nodes,
  relationshipCount AS rels

 But I don't know how to write the stream, because these stream don't wok, it only gets candidates

CALL gds.nodeSimilarity.stream('test3')
YIELD node1, node2, similarity
RETURN gds.util.asNode(node1).name AS candidate, gds.util.asNode(node2).name AS job, similarity
ORDER BY similarity DESCENDING, candidate, job

result:

guille_rr_2-1670972676640.png

Thanks!