cugraph.structure.graph_implementation.simpleGraphImpl.degrees#
- simpleGraphImpl.degrees(vertex_subset: Optional[Union[Series, Iterable]] = None) DataFrame [source]#
Compute vertex in-degree and out-degree. 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 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 degrees. 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[‘in_degree’]cudf.Series
The in-degree of the vertex.
- df[‘out_degree’]cudf.Series
The out-degree of the 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.degrees([0,9,12])