> ## Documentation Index
> Fetch the complete documentation index at: https://new.docs.falkordb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PageRank

> Rank nodes based on the number and quality of edges pointing to them, simulating the likelihood of a random traversal landing on each node.

## Introduction

PageRank is an algorithm that measures the importance of each node within the graph based on the number of incoming relationships and the importance of the corresponding source nodes.
The algorithm was originally developed by Google's founders Larry Page and Sergey Brin during their time at Stanford University.

## Algorithm Overview

PageRank works by counting the number and quality of relationships to a node to determine a rough estimate of how important that node is.
The underlying assumption is that more important nodes are likely to receive more connections from other nodes.

The algorithm assigns each node a score, where higher scores indicate greater importance.
The score for a node is derived recursively from the scores of the nodes that link to it, with a damping factor typically applied to prevent rank sinks.
For example, in a network of academic papers, a paper cited by many other highly cited papers will receive a high PageRank score, reflecting its influence in the field.

## Syntax

The PageRank procedure has the following call signature:

```cypher theme={null}
CALL algo.pageRank(
    label,
    relationship-type
)
YIELD node, score
```

### Parameters

| Name                | Type   | Default | Description                                                                  |
| ------------------- | ------ | ------- | ---------------------------------------------------------------------------- |
| `label`             | String | null    | The label of nodes to run the algorithm on. If null, all nodes are used.     |
| `relationship-type` | String | null    | The relationship type to traverse. If null, all relationship types are used. |

### Yield

| Name    | Type  | Description                          |
| ------- | ----- | ------------------------------------ |
| `node`  | Node  | The node processed by the algorithm. |
| `score` | Float | The PageRank score for the node.     |

## Examples

### Unweighted PageRank

First, let's create a sample graph representing a citation network between scientific papers:

```cypher theme={null}
CREATE 
  (paper1:Paper {title: 'Graph Algorithms in Database Systems'}),
  (paper2:Paper {title: 'PageRank Applications'}),
  (paper3:Paper {title: 'Data Mining Techniques'}),
  (paper4:Paper {title: 'Network Analysis Methods'}),
  (paper5:Paper {title: 'Social Network Graph Theory'}),

  (paper2)-[:CITES]->(paper1),
  (paper3)-[:CITES]->(paper1),
  (paper3)-[:CITES]->(paper2),
  (paper4)-[:CITES]->(paper1),
  (paper4)-[:CITES]->(paper3),
  (paper5)-[:CITES]->(paper2),
  (paper5)-[:CITES]->(paper4)
```

<img src="https://mintcdn.com/falkordb-core/4RKo-4HTPunDsB0h/images/graph_page_rank.png?fit=max&auto=format&n=4RKo-4HTPunDsB0h&q=85&s=006671a552a4a00893dc87b7528a6408" alt="Graph PR" width="1188" height="1238" data-path="images/graph_page_rank.png" />

Now we can run the PageRank algorithm on this citation network:

```cypher theme={null}
CALL algo.pageRank('Paper', 'CITES')
YIELD node, score
RETURN node.title AS paper, score
ORDER BY score DESC
```

Expected results:

| paper                                | score |
| ------------------------------------ | ----- |
| Graph Algorithms in Database Systems | 0.43  |
| Data Mining Techniques               | 0.21  |
| PageRank Applications                | 0.19  |
| Network Analysis Methods             | 0.14  |
| Social Network Graph Theory          | 0.03  |

## Usage Notes

**Interpreting scores**:

* PageRank scores are relative, not absolute measures
* The sum of all scores in a graph equals 1.0
* Scores typically follow a power-law distribution

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="What is the syntax for running PageRank in FalkorDB?">
    Use `CALL algo.pageRank(label, relationship_type) YIELD node, score`. Both parameters are optional — pass `null` to include all nodes or all relationship types.
  </Accordion>

  <Accordion title="How do I interpret PageRank scores?">
    Scores are **relative** values that sum to 1.0 across all nodes. Higher scores indicate greater importance based on incoming link structure. Scores follow a power-law distribution.
  </Accordion>

  <Accordion title="Can I run PageRank on a subset of nodes?">
    Yes. Pass a node label as the first argument, e.g. `CALL algo.pageRank('Paper', 'CITES')` to only compute scores for nodes with that label.
  </Accordion>

  <Accordion title="When should I use PageRank vs Betweenness Centrality?">
    Use **PageRank** to measure overall *influence* based on incoming connections. Use **[Betweenness Centrality](/algorithms/betweenness-centrality)** to find *bridge* nodes that connect different parts of the graph.
  </Accordion>

  <Accordion title="Does PageRank consider edge direction?">
    Yes. PageRank is designed for directed graphs and scores are based on **incoming** relationships. Nodes with many high-scoring inbound connections receive higher scores.
  </Accordion>
</AccordionGroup>
