Skip to main content

Betweenness Centrality

SQL function: cugraph_betweenness_centrality

Compute exact or explicitly seeded/k-sampled approximate betweenness centrality scores.

Signature

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

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

Quickstart

SELECT * FROM cugraph_betweenness_centrality('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

OptionTypeDefaultConstraintsDescription
exact_vertex_thresholdUInt64100000Maximum actual graph vertex count allowed for exact betweenness without explicit seeds or k.
include_endpointsBooleanfalse
kUInt64|nullnullmin 1; mutually exclusive with seedsDeterministic approximate seed count. Execution uses the first k distinct graph vertices in stable order and refuses k larger than the actual vertex count.
normalizedBooleantrue
seedsList<Int64>|nullnullmutually exclusive with kExplicit seed vertices for approximate betweenness. Null requests exact all-vertex betweenness unless k is set.

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
vertexInt64noAlgorithm result column.
valueFloat64noAlgorithm result column.
note

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

Examples

Canonical call (generic table/column names):

SELECT * FROM cugraph_betweenness_centrality('target_edges')
Dataset-specific examples

TODO: add runnable examples against a concrete dataset (edge table, real vertex ids, expected output). These are intentionally left for a follow-up.

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_betweenness_centrality',
'your_edges_table',
'{"src_col":"src","dst_col":"dst"}'
);

See Discovery & validation for the full cugraph_validate_call contract.