Skip to main content

PageRank

UDTF: cugraph_pagerank

Official cuGraph reference: C API

Rank vertices by the stationary probability of a damped random walk that follows outgoing edges.

Quickstart​

The call below supplies edges from registered relation target_edges with canonical src and dst columns and may include weight. Substitute your own registered relations.

SELECT *
FROM cugraph_pagerank(
edges => (SELECT src, dst FROM target_edges)
);

Inputs​

Every relation is a named parenthesized SELECT subquery. The required edges role uses canonical src and dst columns; every role, its canonical columns, and their accepted Arrow types are listed under Relation arguments. Metadata validation resolves registered tables named in its JSON request.

Endpoint columns accept numeric Int32, Int64 vertex IDs or logical string Utf8, LargeUtf8, Utf8View vertex IDs; string vertex-identity outputs are canonicalized to Utf8 (native mapping Int64) while scores, distances, counts, coordinates, and opaque labels stay numeric. The shared vertex-ID contract is summarized in Vertex ID support; the concrete call-specific schema comes from gpu_validate_call.

Logical string side-input limitations:

  • edge ID columns and edge-ID predicate side inputs are not supported for logical string graphs

Arguments and options​

Relation arguments​

ArgumentRequiredColumnsDescription
edgesyes
  • src, dst: Int32, Int64, Utf8, LargeUtf8, Utf8View
  • weight (optional): Float32, Float64
  • edge_id (optional): Int32, Int64
edge relation with canonical src and dst columns, plus optional weight and edge_id columns

Every edge_id column must have the integer type of src and dst; string-keyed graphs accept no edge IDs.

Named value arguments​

OptionTypeDefaultConstraintsDescription
alphanumber0.85min 0; max 1PageRank damping factor in [0, 1]
epsilonnumber0.00001> 0positive convergence tolerance
max_iterationsinteger100min 1; max 4294967295maximum iteration count, at least 1

Graph construction options​

Graph construction follows the shared defaults (directed=true, renumbering, python_cugraph policy) documented in Graph Construction Options.

Output​

ColumnTypeNullableDescription
vertexInt64|Utf8noVertex receiving the PageRank score.
valueFloat64noPageRank score for the vertex.

These are generic descriptor schemas; run gpu_validate_call to get the concrete, table-specific output schema.

Examples​

These examples run on the citation network demo dataset (4.9M papers, 45.6M src-cites-dst edges).

Which papers rank highest when citations from influential papers count more?​

Raw citation counts treat each incoming citation equally. PageRank weights citations by the scores of the citing papers, and the metadata join lets us compare that ranking with each paper's reported citation count.

SELECT p.title, p.year, p.n_citation, r.value AS pagerank
FROM cugraph_pagerank(edges => (SELECT src, dst FROM citation_edges)) r
JOIN papers p ON p.paper_id = r.vertex
ORDER BY r.value DESC
LIMIT 5;
titleyearn_citationpagerank
Finite automata and their decision problems19591,4010.00139
The Mathematical Theory of Communication194948,3270.00134
The reduction of two-way automata to one-way automata19592240.00126
The complexity of theorem-proving procedures19714,5920.00073
A mathematical theory of communication194822,1220.00066

The first and third rows have reported counts of 1,401 and 224. Their positions show how the influence-based ranking can differ from a simple citation count.

Where does the original PageRank paper rank by its own algorithm?​

Ranking the paper that introduced PageRank by its own method gives a concrete reference point in this corpus. The corpus has two 1998 records with this title, so the query selects the Web Conference record by year and venue.

WITH ranked AS (
SELECT vertex, value, ROW_NUMBER() OVER (ORDER BY value DESC) AS rank
FROM cugraph_pagerank(edges => (SELECT src, dst FROM citation_edges)))
SELECT r.rank, p.title, p.year, r.value
FROM ranked r JOIN papers p ON p.paper_id = r.vertex
WHERE p.title = 'The anatomy of a large-scale hypertextual Web search engine'
AND p.year = 1998 AND p.venue = 'The Web Conference';
ranktitleyearvalue
115The anatomy of a large-scale hypertextual Web search engine19980.000143

In this run, the Web Conference record ranks #115 among vertices scored by PageRank on this graph.

Which papers were central to the citation network through 2000?​

An era-specific ranking can surface papers that structure literature from that period. This query keeps citations whose source and destination papers are both dated 1901 through 2000, then ranks that subgraph with PageRank.

CREATE OR REPLACE VIEW edges_pre2000 AS
SELECT e.src, e.dst
FROM citation_edges e
JOIN papers ps ON ps.paper_id = e.src
JOIN papers pd ON pd.paper_id = e.dst
WHERE ps.year BETWEEN 1901 AND 2000 AND pd.year BETWEEN 1901 AND 2000;

SELECT p.year, p.title
FROM cugraph_pagerank(edges => (SELECT src, dst FROM edges_pre2000)) r
JOIN papers p ON p.paper_id = r.vertex
ORDER BY r.value DESC
LIMIT 6;
yeartitle
1959Finite automata and their decision problems
1959The reduction of two-way automata to one-way automata
1949The Mathematical Theory of Communication
1974The Design and Analysis of Computer Algorithms
1958Preliminary report: international algebraic language
1963Machine perception of three-dimensional solids

Automata theory, information theory, the classic algorithms textbook, and the ALGOL report: the view's WHERE clause restricts the graph to one era, and the algorithm re-ranks the field within it.

Limits​

No algorithm-specific limitations.

To dry-run validate relation metadata, column types, and options without execution, see gpu_validate_call.