neo4j-contrib / neo4j-graph-algorithms

Efficient Graph Algorithms for Neo4j
https://github.com/neo4j/graph-data-science/
GNU General Public License v3.0
770 stars 194 forks source link

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

Open mendter opened 6 years ago

mendter commented 6 years ago

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 commented 6 years ago

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?

ghost commented 6 years ago

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

mendter commented 6 years ago

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

ghost commented 6 years ago

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.

mendter commented 6 years ago

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

mneedham commented 6 years ago

@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