GraphGists

HR analytics & finding candidates

Introduction to Problem

The basic problem of a Human Resource (HR) function is to find, retain and empower persons. Good HR professionals are able to provide their organization with people who have the skills to match their company’s ambitions.

Today, via Linkedin and web job boards, it is probably easier for an HR professional to know about the people outside his/her organization than about the people inside. Linkedin has managed to build a powerful data platform about the skills, relationships, job histories, interests and contact information of >300M persons.

With Neo4j it is now possible to make that kind of recommendations. Let’s see how.


Our data model for HR analytics

we are going to use data and queries prepared by Rik van Bruggen from Neo Technology. In our dataset we are going to have people, competencies and companies :

A graph data model for recruitment.

People can be linked together by a friendship relationship. People have competencies and work or have worked for companies. In the picture above, we see that James works for Acme and that Paul has worked for the same company. They are friends and share a knowledge of general management. James knows financial management whereas Paul knows Python.


Sample Data Set

Let’s setup the data.

One way to do that is to use amazing Graphgen from Neoxygen.io. All it takes is a few lines of code to describe my dataset :

(p:Person {firstname: firstName, lastname: lastName } *35)-[:FRIEND_OF *n..n]→(p)

(p)-[:HAS_COMPETENCY *n..n]→(s:Skill *20)

(p)-[:WORKS_FOR *n..n]→(c:Company {name: company, desc: catchPhrase} *20)

(p)-[:WORKED_FOR *n..n]→(c)

(s)-[:IS_REQUIRED *n..n]→(d:Job *5)


You can download the complete dataset here.

What kinds of competencies are in my company

Now that we have data about the people within our organization and their skills, it is time to start asking questions. Let’s start with a simple one . We are a recruiter within a company called Siliconfind. We want to know what the top competencies within our company.

match (n:Person)-[:HAS_COMPETENCY]->(co:Competency), (n)-->(cp:Company {name:'Siliconfind'})
return co.name as competencies, count(n) as number_of_experts
order by count(n) desc
limit 5

Siliconfind wants to hire a software engineer

Siliconfind wants to hire a software engineer who knows Java and Python. Having skills in Project Management would be a plus. Let’s see if we have that within our own company.

match (p:Person)-[:HAS_COMPETENCY]->(c2:Competency {name:"Java Programming"}), (p)-[:HAS_COMPETENCY]->(c3:Competency {name:"Python Programming"}), (p)-[:HAS_COMPETENCY]->(c4:Competency), (p:Person)-[:WORKS_FOR]->(n:Company {name:'Siliconfind'})
optional match (p)-[:HAS_COMPETENCY]->(c4:Competency {name:'Project Management'})
return p.first_name, p.last_name, collect(c4.name)

Here we search our data to find someone who 1) has a competency in Java Programming, 2) has a competency in Python Programming and 3) works for Siliconfind. Looks like there is no result : we do not have the right match within our own talent pool.

Looking into the personal network of Siliconfind’s employees

Let’s try to see within the personal network of our employees if there is a good match :

MATCH (c:Company {name:'Siliconfind'})<-[WORKS_FOR]-(p1:Person)-[:FRIEND_OF]-(p2:Person) with p2 match (p2)-[:HAS_COMPETENCY]->(c2:Competency {name:"Java Programming"}), (p2)-[:HAS_COMPETENCY]->(c3:Competency {name:"Python Programming"})
return distinct p2.first_name as first_name, p2.last_name as last_name, c2.name as skill_1, c3.name as skill_2

Matching the requirements of a job ad

Can we find potential candidates for a job automatically? Let’s add another entity in our data model : a job. A job is linked to competencies via a "REQUIRES" relationships. Finding a perfect match for a given job means finding someone who matches all the required competencies of a job.

We are going to look for a software engineer. We want him to be proficient in Python, Scala and Project Management. The node “Software Engineer” is thus linked to these 3 competencies. Here is how to make the query that will return us the list of people matching our requirements :

match (o:Job {name:'Software Engineer'})-[:IS_REQUIRED]->req<-[:HAS_COMPETENCY]-p
with o, p, count(req) as c
where length(o-[:IS_REQUIRED]-()) = c
return p, c

Conclusion

Graph databases like Neo4j can help companies improve their HR performances. It is not so surprising : after all a company is a social network…​and thus a graph!

For more graph-related use cases, make sure to check the blog of Linkurious.