-1

I have users and they have associated skills that are ranked from 0 to 10 (0 being awful, 10 being awesome), for example:

Desc

There's a user UA (top left) and they have two corresponding skills SA (top right) and SC (bottom right). Similarly, UB has SB and UC has SC.

Each skill for a user has a ranking (for example UA SA is 9/10, UA SC 8/10 and UC SC 7/10).

I want to implement search on this graph - for example, given that I'm looking for people who have a skill SC, I want to find who's from the existing users is the best fit.

I have studied pagerank before, but I'm not sure how to proceed with this type of problem. I found here that it is possible to apply PageRank to recommendation system, but I can't figure out how to use it in this exact situation. The current workflow as I understand is:

  1. Based on the skill that the query is on, leave only those users who have associated skills (in the example we're looking for SC, so we only leave UA and UC and remove UB and its edges to skills from the graph)
  2. Somehow rank users using PageRank.

I also found this python library called networkX. Does anyone know if it is possible to solve this problem using that library?

karolyzz
  • 480
  • 4
  • 28

1 Answers1

0

I think you might need to provide a more complex example or explain more what your goal is. PageRank seems way more complicated than necessary. It seems like you just need to find the user best at the skill in question:

users = {
    'userA': {'skillA': 8, 'skillC': 7},
    'userB': {'skillB': 9},
    'userC': {'skillC': 8}
}

def find_best(skill):
    return sorted([(skills[skill], name) for name, skills in users.items() if skill in skills])[-1]

Example:

>>> find_best('skillC')
(8, 'userC')
Colin
  • 10,447
  • 11
  • 46
  • 54