---
title: "Weighted PageRank"
component: "graph-ml"
version: "3.10"
module: "centrality-algorithms"
html_url: "/graph-ml/3.10/centrality-algorithms/weighted-pagerank"
canonical_url: "https://www.tigergraph.com/docs/graph-ml/3.10/centrality-algorithms/weighted-pagerank"
markdown_url: "https://www.tigergraph.com/docs/graph-ml/3.10/centrality-algorithms/weighted-pagerank.md"
---

[View as HTML](https://www.tigergraph.com/docs/graph-ml/3.10/centrality-algorithms/weighted-pagerank)

# Weighted PageRank

Supported Graph Characteristics

| Weighted edges |
| --- |
| Directed edges |
| Undirected edges |
| Homogeneous vertex types |

The only difference between weighted PageRank and standard PageRank is that edges have weights, and the influence that a vertex receives from an in-neighbor is multiplied by the weight of the in-edge.

## Specifications

```gsql
tg_pagerank_wt (SET<STRING> v_type_set, SET<STRING> e_type_set, STRING weight_attribute,
  FLOAT max_change=0.001, INT maximum_iteration=25, FLOAT damping=0.85, INT top_k=100,
   BOOL print_results = TRUE, STRING result_attribute =  "", STRING file_path = "",
   BOOL display_edges = FALSE)
```

### Parameters

| **Parameter** | Description | Default |
| --- | --- | --- |
| `STRING v_type` | Names of vertex types to use | (empty string) |
| `STRING e_type` | Names of edge types to use | (empty string) |
| `STRING weight_attribute` | Name of edge weight attribute | (empty string) |
| `FLOAT max_change` | PageRank will stop iterating when the largest difference between any vertex's current score and its previous score ≤`max_change`. That is, the scores have become very stable and are changing by less than `max_change` from one iteration to the next. | 0.001 |
| `INT maximum_iteration` | Maximum number of iterations. | 25 |
| `FLOAT damping` | Fraction of score that is due to the score of neighbors. The balance (1 - damping) is a minimum baseline score that every vertex receives. | 0.85 |
| `INT top_k` | Sort the scores highest first and output only this many scores | 100 |
| `BOOL print_results` | If True, output JSON to standard output | True |
| `STRING result_attribute` | If not empty, store PageRank values in FLOAT format to this vertex attribute | (empty string) |
| `STRING file_path+` | If not empty, write output to this file. | (empty string) |
| `BOOL display_edges` | If true, include the graph's edges in the JSON output, so that the full graph can be displayed. | False |

### Output

Computes a weighted PageRank value (FLOAT type) for each vertex.

The result size is equal to \\$V\\$, the number of vertices in the graph, because a value is computed for every vertex.

### Time complexity

This algorithm has a time complexity of \\$O(E\*k)\\$ where \\$E\\$ is the number of edges and \\$k\\$ is the number of iterations.

The number of iterations is data-dependent, but the user can set a maximum. Parallel processing reduces the time needed for computation.

### Run commands

#### Schema-Free Query

```gsql
RUN QUERY tg_pagerank_wt (<parameters>)
```

#### Packaged Template Query

```gsql
CALL GDBMS_ALGO.centrality.pagerank_wt (<parameters>)
```
