I have a dataset - around 30000 users and I want to calculate an influence of each user based on UserRank algorithm, which is based on PageRank:
For each user I have a list of followers. I tried to calculate it in Python, but I'm getting:
RecursionError: maximum recursion depth exceeded while calling a Python object
Here's the code:
def calculate_user_rank(user_id):
user_rank = 0
for j in user[user_id]["followers"]:
user_rank += (1 + (user[user_id]["followers_count"]/user[user_id]["tweets"]) * calculate_user_rank(j))/user[j]["followers_count"]
return user_rank
Is there any way how to calculate this measure for each user?