neo4j-graph-algorithms icon indicating copy to clipboard operation
neo4j-graph-algorithms copied to clipboard

How to calculate personalized PageRank (PPR) with call.pagerank()

Open mendter opened this issue 6 years ago • 6 comments

Hello graph-algorithms-team,

I'm trying to develop a recommendation engine with python (django) and neo4j. Now I've found your package and I like it very much! The documentation is great and intuitive but I'm missing an example for personalized PageRank.

I'm sure its possible with your module but I'm not sure how. Could you provide some basic cypher example for me and also put it into your documentation? All the recommendation beginners would love this!

Great Package! Thank you Max

mendter avatar Nov 11 '17 13:11 mendter

So as far as I understand the normal PageRank algorithm performs a random jump to another node. The only thing which is different to personalized PageRank is, that in PPR the jump is always performed back to the same Node (the current user-node).

Is it possible to define such a fixed start or jump node?

mendter avatar Nov 13 '17 13:11 mendter

Hi @mendter. I believe your request duplicates issue: https://github.com/neo4j-contrib/neo4j-graph-algorithms/issues/271 . Check it out for more details.

ghost avatar Nov 13 '17 15:11 ghost

Hi rugsor,

you are right.. Wouldn't it be enough to just teleport to the same node over and over again instead to a random one? That would be a minor adjustment to the existing algorithm and would yield first results.

Is there not an option or a cypher available to trigger that adjustment?

Thank you Max

mendter avatar Nov 13 '17 16:11 mendter

Your describing a special case of PPR where your probability (restart) vector looks like [1,0,0,0,0...n], where n equals the number of nodes in the graph. However PPR allows different probabilities. and is not restricted to "jumping" to the same node given "teleportation".

I haven´t studied the implementation used here, but I doubt this can be achieved with only minor adjustments. If you really want to look into PPR there exists implementations for both R (http://igraph.org/) and Apache Spark. I´m currently using the R package, writing results bak to my neo4j graph.

ghost avatar Nov 14 '17 07:11 ghost

Ok thank you for your input. I need to stay in python and want to generate recommendations only in Neo4j. So I have to wait for an implementation..

Thanks Max

mendter avatar Nov 14 '17 09:11 mendter

@mendter Hi,

We've got an implementation of PPR which you can read about here - https://neo4j.com/docs/graph-algorithms/current/algorithms/page-rank/#_personalized_pagerank

Could you let us know if that meets your needs, and if not what we can do to make it more useful.

Thanks, Mark

mneedham avatar Sep 04 '18 09:09 mneedham