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. Substitute your own registered relations.

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.

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​

This UDTF has no algorithm-specific value arguments. Its inputs are the relation arguments above and the graph construction options below.

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 a metadata gap; it does not identify where unmatched citations came from.

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

For SIFT, the reported count exceeds the observed in-graph degree by 12,649. The result quantifies the gap between metadata and edges in this dataset; it does not show whether the difference comes from missing records, citations outside the dataset, or another coverage mismatch.

Limits​

No algorithm-specific limitations.

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