docstr: 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.
  
  Parameters
  ----------
  vertex_subset : cudf or dask_cudf object, iterable container,
      opt. (default=None)
      a container of vertices for displaying corresponding degree. If not
      set, degrees are computed for the entire set of vertices.
  Returns
  -------
  df : dask_cudf.DataFrame
      Distributed 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.
      df['vertex'] : dask_cudf.Series
          The vertex IDs (will be identical to vertex_subset if
          specified).
      df['degree'] : dask_cudf.Series
          The computed degree of the corresponding vertex.
  Examples
  --------
  >>> M = dask_cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
  ...                   dtype=['int32', 'int32', 'float32'], header=None)
  >>> G = cugraph.Graph()
  >>> G.from_dask_cudf_edgelist(M, '0', '1')
  >>> all_df = G.degree()
  >>> subset_df = G.degree([0,9,12])
docstr_tok: ["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",".","Parameters","--","--","--","--","--","vertex_subset",":","cudf","or","dask_cudf","object",",","iterable","container",",","opt",".","(","default=None",")","a","container","of","vertices","for","displaying","corresponding","degree",".","If","not","set",",","degrees","are","computed","for","the","entire","set","of","vertices",".","Returns","--","--","--","-","df",":","dask_cudf.DataFrame","Distributed","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",".","df","[","'vertex","'","]",":","dask_cudf.Series","The","vertex","IDs","(","will","be","identical","to","vertex_subset","if","specified",")",".","df","[","'degree","'","]",":","dask_cudf.Series","The","computed","degree","of","the","corresponding","vertex",".","Examples","--","--","--","--",">",">",">","M","=","dask_cudf.read_csv","(","datasets_path","\/","'karate.csv","'",",","delimiter=","'","'",",","...","dtype=","[","'int32","'",",","'int32","'",",","'float32","'","]",",","header=None",")",">",">",">","G","=","cugraph.Graph","(",")",">",">",">","G.from_dask_cudf_edgelist","(","M",",","'","0","'",",","'","1","'",")",">",">",">","all_df","=","G.degree","(",")",">",">",">","subset_df","=","G.degree","(","[","0,9,12","]",")"]
code: def degree(self, vertex_subset=None):
      """
      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.
  
      Parameters
      ----------
      vertex_subset : cudf or dask_cudf object, iterable container,
          opt. (default=None)
          a container of vertices for displaying corresponding degree. If not
          set, degrees are computed for the entire set of vertices.
      Returns
      -------
      df : dask_cudf.DataFrame
          Distributed 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.
          df['vertex'] : dask_cudf.Series
              The vertex IDs (will be identical to vertex_subset if
              specified).
          df['degree'] : dask_cudf.Series
              The computed degree of the corresponding vertex.
      Examples
      --------
      >>> M = dask_cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
      ...                   dtype=['int32', 'int32', 'float32'], header=None)
      >>> G = cugraph.Graph()
      >>> G.from_dask_cudf_edgelist(M, '0', '1')
      >>> all_df = G.degree()
      >>> subset_df = G.degree([0,9,12])
  
      """
  
      vertex_in_degree = self.in_degree(vertex_subset)
      vertex_out_degree = self.out_degree(vertex_subset)
      # FIXME: leverage the C++ degree for optimal performance
      vertex_degree = dask_cudf.concat(
          [vertex_in_degree, vertex_out_degree]
      )
      vertex_degree = vertex_degree.groupby(
          ["vertex"], as_index=False
      ).sum(split_out=self.input_df.npartitions)
  
      return vertex_degree
  
imports: import gc
  from typing import Union
  import warnings
  import cudf
  import cupy
  import dask
  import dask_cudf
  from dask import delayed
  from dask.distributed import wait, default_client
  import numpy
  from pylibcugraph import MGGraph, ResourceHandle, GraphProperties, get_two_hop_neighbors, select_random_vertices
  from cugraph.structure import graph_primtypes_wrapper
  from cugraph.structure.graph_primtypes_wrapper import Direction
  from cugraph.structure.number_map import NumberMap
  from cugraph.structure.symmetrize import symmetrize
  from cugraph.dask.common.part_utils import get_persisted_df_worker_map, persist_dask_df_equal_parts_per_worker
  from cugraph.dask.common.mg_utils import run_gc_on_dask_cluster
  from cugraph.dask import get_n_workers
  import cugraph.dask.comms.comms
label_desc: Use image node_id 13 for calling the simpleDistributedGraphImpl obj's underlying member method code with example usage: obj.degree(vertex_subset) and returns: vertex_degree