Skip to main content

In Degrees All

UDTF: cugraph_in_degrees_all

Official cuGraph reference: C API

Count incoming edges for every vertex in the graph.

Quickstart​

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

SELECT *
FROM cugraph_in_degrees_all(
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​

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; this algorithm ignores weight

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

Graph construction options​

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

Output​

ColumnTypeNullableDescription
vertexInt64|Utf8noVertex whose in-degree count is reported.
in_degreeInt64noNumber of incoming edges for the vertex.

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.

How much of each paper's reported citation count appears in this dataset?​

papers.n_citation stores AMiner's reported count, while in_degree counts incoming edges present in this dataset. Their difference measures the gap between reported metadata and the edges present in this snapshot.

SELECT p.year, d.in_degree AS in_graph, p.n_citation AS reported,
p.n_citation - d.in_degree AS citation_gap,
p.title AS paper
FROM cugraph_in_degrees_all(edges => (SELECT src, dst FROM citation_edges)) d
JOIN papers p ON p.paper_id = d.vertex
ORDER BY d.in_degree DESC
LIMIT 5;
yearin_graphreportedcitation_gappaper
200422,89235,54112,649Distinctive Image Features from Scale-Invariant Keypoints
201119,66231,04711,385LIBSVM: A library for support vector machines
198917,20744,17526,968Genetic algorithms in search, optimization, and machine learning
199616,57942,43725,858Fuzzy sets
200115,04834,74119,693Random Forests