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

# extract_node_pagerank

> Calculate network node pagerank. 

Calculates the [PageRank centrality](https://en.wikipedia.org/wiki/PageRank) for each node in the network.
PageRank is a measure of the importance of a node in a network. It is based on the idea that a node is important
if it is linked to by other important nodes. The algorithm is iterative and the importance of a node is calculated
as the sum of the importance of the nodes that link to it. The importance of a node is then distributed to the nodes
it links to. The algorithm is run until convergence. A damping factor is used to avoid the problem of dead ends.

For more information about the algorithm and its parameters see the [wikipedia entry](https://en.wikipedia.org/wiki/PageRank#Damping_factor)
or the original paper [here](http://infolab.stanford.edu/~backrub/google.html).

## Usage

The following example shows how the step can be used in a recipe.

<Accordion title="Examples" icon="code" defaultOpen="true">
  <Tabs>
    <Tab title="Example 1">
      ```stan theme={null}
      extract_node_pagerank(ds.targets, ds.weights) -> (ds.page_rank)
      ```
    </Tab>

    <Tab title="Signature">
      General syntax for using the step in a recipe. Shows the inputs and outputs the step is expected to receive and will produce respectively. For futher details see sections below.

      ```stan theme={null}
      extract_node_pagerank(targets: list[number], *weights: list[number], {
          "param": value,
          ...
      }) -> (pagerank: number)
      ```
    </Tab>
  </Tabs>
</Accordion>

## Inputs & Outputs

The following are the inputs expected by the step and the outputs it produces. These are generally
columns (`ds.first_name`), datasets (`ds` or `ds[["first_name", "last_name"]]`) or models (referenced
by name e.g. `"churn-clf"`).

<Accordion title="Inputs" icon="right-to-bracket">
  <ParamField path="targets" type="column[list[number]]" required>
    A column containing link targets. Source is implied in the index.
  </ParamField>

  <ParamField path="*weights" type="column[list[number]]">
    An optional column containing link weights.
  </ParamField>
</Accordion>

<Accordion title="Outputs" icon="right-from-bracket">
  <ParamField path="pagerank" type="column[number]" required>
    Calculates the Google PageRank for the specified vertices.
  </ParamField>
</Accordion>

## Configuration

The following parameters can be used to configure the behaviour of the step by including them in
a json object as the last "input" to the step, i.e. `step(..., {"param": "value", ...}) -> (output)`.

<Accordion title="Parameters" defaultOpen="true" icon="sliders">
  <ParamField path="directed" type="boolean" default="false">
    Whether the links are directed or not.
  </ParamField>

  <ParamField path="damping" type="number">
    The damping factor.
    `1 - damping` is the PageRank value for nodes with no incoming links. It is also the probability of
    resetting the random walk to a uniform distribution in each step.

    Values must be in the following range:

    ```javascript theme={null}
    0 ≤ damping ≤ 1
    ```
  </ParamField>
</Accordion>
