Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

HR Analytics with Neo4j : Match a Person with a Job

DZone's Guide to

HR Analytics with Neo4j : Match a Person with a Job

·
Free Resource

Linkedin is able to match millions of people with jobs whereas most companies struggle to replicate this internally. Graph technologies can change that. Let’s learn how to match people and jobs and make everyone happy!

How can HR departments become smarter?

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. Most HR departments would dream of having the same data for their own employees!

The paradox is that HR have access to a lot of data. Furthermore, employees could volunteer more information in exchange for jobs that match their aspirations. With graph technology like Neo4j it is now possible to make that kind of sophisticated recommendations. Let’s see how.

The graph of Human Resources

In order to demonstrate how to use Neo4j for HR analytics, we are going to use data and queries prepared by Rik van Bruggen from Neo Technology. Recently he discussed the subject of HR analytics in a Meetup in Belgium.

As in all graph project, let’s start with the data model. In our dataset we are going to have people, competencies and companies :


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.

We are going to use the small dataset prepared by Rik. You can find it here. That data is a Neo4j graph database you can install on your computer to follow the rest of the tutorial or experiment on your own.

Playing matchmaker

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. To get that answer, we’ll use Cypher, the query language associated with Neo4j :

//What kinds of competencies are in my 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

We get a quick answer :

competencies number_of_experts
People Management 13
General Management 9
Carpenter 8
Java Programming 7
Scala Programming 6

It is time to start recruiting! We have a new job opening : 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 :

//Find people in our company that have a skill in java and python programming and may know project management
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. Let’s try to see within the personal network of our employees if there is a good match :

//Find friends of our employees that have a skill in java and python programming
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

This query looks up the friends of our employees and checks if they have a competency in Java and Python. This gives us a few results :

first_name last_name skill_1 skill_2
Damon Cruz Java Programming Python Programming
Gina Jenkins Java Programming Python Programming
Rick Carpenter Java Programming Python Programming
Whitney Ryan Java Programming Python Programming

We have a few potential matches for our new job opening. We can visualize the social connections between these people and our company via Linkurious.


Our search has provided 4 interesting leads as the candidates we have sourced already have a friend within the company. It should be easier to attract them!

Finding the perfect match

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 :

//Find a perfect candidate for our software engineer position
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

This immediately offers us 3 potential candidates that match all the requirements we have : Jaime Rogers, Tommie Holland and Alberto Boone.

If you are interested in exploring further what can be done in terms of job matching, I recommend checking out the work of Reply : part 1 and part 2.

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!


Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}