Nodes A and B more interconnected

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:

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

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

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

Thanks, it works
(migrated from khoros post Solved: Re: Nodes A and B more interconnected - Neo4j - 62824)

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

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!