cugraph.sorensen_coefficient#

cugraph.sorensen_coefficient(G: Graph, ebunch: DataFrame = None) DataFrame[source]#

Compute sorensen coefficient.

Parameters:
Gcugraph.Graph

cuGraph Graph instance, should contain the connectivity information as an edge list. The graph should be undirected where an undirected edge is represented by a directed edge in both direction. The adjacency list will be computed if not already present.

This implementation only supports undirected, non-multi Graphs.

ebunchcudf.DataFrame of node pairs, optional (default=None)

A GPU dataframe consisting of two columns representing pairs of vertices (u, v) where u and v are nodes in the graph.

If provided, the Sorensen coefficient is computed for the given vertex pairs. Otherwise, the current implementation computes the sorensen coefficient for all vertices that are two hops apart in the graph.

Returns:
dfcudf.DataFrame

GPU data frame of size E (the default) or the size of the given pairs (first, second) containing the Sorensen weights. The ordering is relative to the adjacency list, or that given by the specified vertex pairs.

df[‘first’]cudf.Series

The first vertex ID of each pair (will be identical to first if specified).

df[‘second’]cudf.Series

The second vertex ID of each pair (will be identical to second if specified).

df[‘sorensen_coeff’]cudf.Series

The computed Sorensen coefficient between the first and the second vertex ID.

Examples

>>> from cugraph.datasets import karate
>>> from cugraph import sorensen_coefficient
>>> G = karate.get_graph(download=True, ignore_weights=True)
>>> df = sorensen_coefficient(G)