pylibhipgraph.betweenness_centrality

Contents

pylibhipgraph.betweenness_centrality#

2025-05-20

2 min read time

Applies to Linux

betweenness_centrality (ResourceHandle resource_handle, _GPUGraph graph, k, random_state, bool_t normalized bool_t include_endpoints, bool_t do_expensive_check)

Compute the betweenness centrality for all vertices of the graph G. Betweenness centrality is a measure of the number of shortest paths that pass through a vertex. A vertex with a high betweenness centrality score has more paths passing through it and is therefore believed to be more important.

Parameters#

resource_handleResourceHandle

Handle to the underlying device resources needed for referencing data and running algorithms.

graphSGGraph or MGGraph

The input graph, for either Single or Multi-GPU operations.

kint or device array type or None, optional (default=None)

If k is not None, use k node samples to estimate betweenness. Higher values give better approximation. If k is a device array type, use the content of the list for estimation: the list should contain vertex identifiers. If k is None (the default), all the vertices are used to estimate betweenness. Vertices obtained through sampling or defined as a list will be used as sources for traversals inside the algorithm.

random_stateint, optional (default=None)

if k is specified and k is an integer, use random_state to initialize the random number generator. Using None defaults to a hash of process id, time, and hostname If k is either None or list or cudf objects: random_state parameter is ignored.

normalizedbool_t

Normalization will ensure that values are in [0, 1].

include_endpointsbool_t

If true, include the endpoints in the shortest path counts.

do_expensive_checkbool_t

A flag to run expensive checks for input arguments if True.