- cugraph.sorensen(input_graph: Graph, vertex_pair: Optional[DataFrame] = None, do_expensive_check: bool = False, use_weight: bool = False)#
Compute the Sorensen coefficient between each pair of vertices connected by an edge, or between arbitrary pairs of vertices specified by the user. Sorensen coefficient is defined between two sets as the ratio of twice the volume of their intersection divided by the volume of each set. If first is specified but second is not, or vice versa, an exception will be thrown.
cugraph.sorensen, in the absence of a specified vertex pair list, will compute the two_hop_neighbors of the entire graph to construct a vertex pair list and will return the sorensen coefficient for those vertex pairs. This is not advisable as the vertex_pairs can grow exponentially with respect to the size of the datasets
cuGraph Graph instance, should contain the connectivity information as an edge list. The adjacency list will be computed if not already present.
This implementation only supports undirected, non-multi edge Graph.
- vertex_paircudf.DataFrame, optional (default=None)
A GPU dataframe consisting of two columns representing pairs of vertices. If provided, the Sorensen coefficient is computed for the given vertex pairs. If the vertex_pair is not provided then the current implementation computes the Sorensen coefficient for all adjacent vertices in the graph.
- do_expensive_checkbool, optional (default=False)
Deprecated. This option added a check to ensure integer vertex IDs are sequential values from 0 to V-1. That check is now redundant because cugraph unconditionally renumbers and un-renumbers integer vertex IDs for optimal performance, therefore this option is deprecated and will be removed in a future version.
- use_weightbool, optional (default=False)
Flag to indicate whether to compute weighted sorensen (if use_weight==True) or un-weighted sorensen (if use_weight==False). ‘input_graph’ must be weighted if ‘use_weight=True’.
GPU data frame of size E (the default) or the size of the given pairs (first, second) containing the Sorensen index. The ordering is relative to the adjacency list, or that given by the specified vertex pairs.
The first vertex ID of each pair (will be identical to first if specified).
The second vertex ID of each pair (will be identical to second if specified).
The computed sorensen coefficient between the first and the second vertex ID.
>>> from cugraph.datasets import karate >>> from cugraph import sorensen >>> input_graph = karate.get_graph(download=True, ignore_weights=True) >>> df = sorensen(input_graph)