Compute vertex degree, which is the total number of edges incident to a vertex (both in and out edges). By default, this method computes degrees for the entire set of vertices. If vertex_subset is provided, then this method optionally filters out all but those listed in vertex_subset.

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.


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


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


The computed degree of the corresponding vertex.


>>> 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')
>>> all_df =
>>> subset_df =[0,9,12])