Skip to main content

Degrees All

UDTF: cugraph_degrees_all

Official cuGraph reference: C API

Count both incoming and outgoing 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_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 degree counts are reported.
in_degreeInt64noNumber of incoming edges for the vertex.
out_degreeInt64noNumber of outgoing 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.

Which widely cited papers also provide extensive bibliographies?​

Papers with many incoming citations and many outgoing references can be useful starting points for exploring a field's literature. This query selects papers with more than 2,000 in-graph citations and more than 200 references in the dataset.

SELECT d.in_degree, d.out_degree, p.year, p.title
FROM cugraph_degrees_all(edges => (SELECT src, dst FROM citation_edges)) d
JOIN papers p ON p.paper_id = d.vertex
WHERE d.out_degree > 200 AND d.in_degree > 2000
ORDER BY d.in_degree DESC
LIMIT 4;
in_degreeout_degreeyeartitle
5,1154341996Handbook of Applied Cryptography
3,6662172002Machine learning in automated text categorization
2,9542402009Anomaly detection: A survey
2,5645642015Deep learning in neural networks

For a single direction with metadata comparisons, see cugraph_in_degrees_all and cugraph_out_degrees_all.

Limits​

No algorithm-specific limitations.

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