cugraph.structure.graph_implementation.simpleGraphImpl.in_degree#

simpleGraphImpl.in_degree(vertex_subset: Optional[Union[Series, Iterable]] = None) DataFrame[source]#

Compute vertex in-degree. Vertex in-degree is the number of edges pointing into the vertex. By default, this method computes vertex degrees for the entire set of vertices. If vertex_subset is provided, this method optionally filters out all but those listed in vertex_subset.

Parameters:
vertex_subsetcudf.Series or iterable container, optional

A container of vertices for displaying corresponding in-degree. If not set, degrees are computed for the entire set of vertices.

Returns:
dfcudf.DataFrame

GPU DataFrame of size N (the default) or the size of the given vertices (vertex_subset) containing the in_degree. The ordering is relative to the adjacency list, or that given by the specified vertex_subset.

df[vertex]cudf.Series

The vertex IDs (will be identical to vertex_subset if specified).

df[degree]cudf.Series

The computed in-degree of the corresponding vertex.

Examples

>>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
...                   dtype=['int32', 'int32', 'float32'], header=None)
>>> G = cugraph.Graph()
>>> G.from_cudf_edgelist(M, '0', '1')
>>> df = G.in_degree([0,9,12])