HITS
UDTF: cugraph_hits
Official cuGraph reference: C API
Compute mutually reinforcing hub and authority scores: strong hubs point to strong authorities, and strong authorities are linked from strong hubs.
Quickstart
The call below supplies edges from registered relation target_edges with canonical src and dst columns and may include weight.
SELECT *
FROM cugraph_hits(
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.
The vertex-ID types this UDTF accepts, the numeric types a per-call codebook maps to native ids, and its string-key limits are listed in Vertex ID support; the concrete call-specific schema comes from gpu_validate_call.
Arguments and options
Relation arguments
Every edge_id column must have the integer type of src and dst; string-keyed graphs accept no edge IDs.
Named value arguments
Graph construction options
Graph construction follows the shared defaults (directed=true, renumbering, python_cugraph policy) documented in Graph Construction Options.
Output
These are generic descriptor schemas. Run gpu_validate_call to get the concrete, table-specific output schema.
Examples
This example runs on the citation network demo dataset.
Which papers act as reading guides, and which works are their shared foundations?
HITS scores two citation roles through mutually reinforcing links. A paper's hub score reflects the authority of works it cites; its authority score reflects how strongly it is cited by hubs. This query ranks the top four vertices for each role and joins both lists back to paper titles and years.
CREATE OR REPLACE TABLE hits_snapshot AS
SELECT vertex, hub_score, authority_score
FROM cugraph_hits(edges => (SELECT src, dst FROM citation_edges));
WITH guides AS (
SELECT vertex, hub_score AS score, 'Reading guide' AS role
FROM hits_snapshot
ORDER BY hub_score DESC, vertex
LIMIT 4),
foundations AS (
SELECT vertex, authority_score AS score, 'Foundation' AS role
FROM hits_snapshot
ORDER BY authority_score DESC, vertex
LIMIT 4)
SELECT h.role, p.year, p.title
FROM (
SELECT * FROM guides
UNION ALL
SELECT * FROM foundations
) h
JOIN papers p ON p.paper_id = h.vertex
ORDER BY h.role, h.score DESC, h.vertex;
One snapshot supplies both rankings.
Limits
- scores can differ in the last digits between runs because the hub update accumulates with floating-point atomics