Skip to main content

Degrees All

SQL function: cugraph_degrees_all

Compute in-degree and out-degree for every vertex.

Signature

cugraph_degrees_all(table_name [, src_col, dst_col [, weight_col [, options_json]]])

Allowed argument counts: 1, 3, 4, 5.

Quickstart

SELECT * FROM cugraph_degrees_all('target_edges')

Positional arguments

ArgumentTypeRequiredDefaultNotes
table_nameUtf8yes
src_colUtf8nosrc
dst_colUtf8nodst
weight_colUtf8|nullnoaccepted as an edge-column binding; native algorithm execution does not consume weights; semantic effect: none for this algorithm
options_jsonUtf8no

JSON options

This algorithm has no algorithm-specific options.

Graph construction options

Shared by all cuGraph functions, shown here with this function's defaults. The construction_policy option controls whether Nexus requests Python cuGraph-compatible edge normalization or bypasses it for raw libcugraph-style construction; see graph construction options for the full policy guide.

OptionTypeDefaultConstraintsDescription
construction_policyUtf8"python_cugraph"one of "python_cugraph", "raw_libcugraph"Edge-list construction semantics used before calling libcugraph.
directedBooleantrueWhether graph construction treats edges as directed.
renumberBooleantrueWhether graph construction may renumber external vertex identifiers internally.

Output schema

ColumnTypeNullableDescription
vertexInt64noVertex whose degree counts are reported.
in_degreeInt64noNumber of incoming edges for the vertex.
out_degreeInt64noNumber of outgoing edges for the vertex.
note

These are the generic registry schemas. Run cugraph_validate_call for the concrete, table-specific output schema of a particular call.

Examples

This example runs on the citation network demo dataset.

Both directions at once: the hybrid giants

One call returns in-degree and out-degree together, so a compound WHERE finds papers that are simultaneously heavy citers and heavily cited — encyclopedic works that anchor a field and survey it at the same time:

SELECT d.in_degree, d.out_degree, p.year, p.title
FROM cugraph_degrees_all('citation_edges', 'src', 'dst') 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.

Limitations & notes

  • dry-run validates table resolution, column presence, static dtypes, and options only
  • dry-run does not scan edge data, construct a graph, or prove source-vertex existence

Validate before running

Always dry-run a call before executing it. Validation checks the function, table, columns, dtypes, and options without touching the GPU:

SELECT * FROM cugraph_validate_call(
'cugraph_degrees_all',
'your_edges_table',
'{"src_col":"src","dst_col":"dst"}'
);

See Discovery & validation for the full cugraph_validate_call contract.