Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-05-2022 04:30 AM
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)
Could I use another cypher or would I have to use apoc similarity, gds.nodeSimilarity?
Thanks !
regards
Solved! Go to Solution.
12-05-2022 02:28 PM
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
12-05-2022 12:51 PM
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
12-05-2022 02:28 PM
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
12-07-2022 04:10 AM
Thanks, it works
12-13-2022 03:05 PM
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:
Thanks!
All the sessions of the conference are now available online