Search code examples
neo4jgraph-databasespagerank

How to implement weighted pagerank algorithm in neo4j ?


Is there any argument in inbuilt pagerank algorithm or a separate algorithm is available for applying pagerank algorithm on a weighted neo4j graph. I found the algorithm here but don't know how to run it interatively on neo4j dekstop.


Solution

  • There is a Neo4j Graph Algorithms Library that contains a page rank algorithm procedure. The procedure signature is as follow:

    CALL algo.pageRank(label:String, relationship:String, {iterations:5, dampingFactor:0.85, write: true, writeProperty:'pagerank', concurrency:4}) YIELD nodes, iterations, loadMillis, computeMillis, writeMillis, dampingFactor, write, writeProperty - calculates page rank and potentially writes back

    You can use the algorithm running a query like this:

    CALL algo.pageRank.stream('Page', 'LINKS', {iterations:20, dampingFactor:0.85})
    YIELD node, score
    RETURN node,score order by score desc limit 20