class_docstr: A GPU Graph Object (Base class of other graph types)
  
  Parameters
  ----------
  m_graph : cuGraph.MultiGraph object or None (default=None)
      Initialize the graph from a cugraph.MultiGraph object
  directed : boolean, optional (default=False)
      Indicated is the graph is directed.
  
  Examples
  --------
  >>> # undirected graph
  >>> G = cugraph.Graph()
  >>> # directed graph
  >>> G = cugraph.Graph(directed=True)
class_docstr_tok: ["A","GPU","Graph","Object","(","Base","class","of","other","graph","types",")","Parameters","--","--","--","--","--","m_graph",":","cuGraph.MultiGraph","object","or","None","(","default=None",")","Initialize","the","graph","from","a","cugraph.MultiGraph","object","directed",":","boolean",",","optional","(","default=False",")","Indicated","is","the","graph","is","directed",".","Examples","--","--","--","--",">",">",">","#","undirected","graph",">",">",">","G","=","cugraph.Graph","(",")",">",">",">","#","directed","graph",">",">",">","G","=","cugraph.Graph","(","directed=True",")"]
docstr: Compute the density of the graph.
  Density is the measure of how many edges are in the graph versus
  the max number of edges that could be present.
  
  Returns
  -------
  density : float
      Density is the measure of how many edges are in the graph versus
      the max number of edges that could be present.
  
  Examples
  --------
  >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
  ...                   dtype=['int32', 'int32', 'float32'], header=None)
  >>> DiG = cugraph.Graph(directed=True)
  >>> DiG.from_cudf_edgelist(M, '0', '1')
  >>> density = G.density()
docstr_tok: ["Compute","the","density","of","the","graph",".","Density","is","the","measure","of","how","many","edges","are","in","the","graph","versus","the","max","number","of","edges","that","could","be","present",".","Returns","--","--","--","-","density",":","float","Density","is","the","measure","of","how","many","edges","are","in","the","graph","versus","the","max","number","of","edges","that","could","be","present",".","Examples","--","--","--","--",">",">",">","M","=","cudf.read_csv","(","datasets_path","\/","'karate.csv","'",",","delimiter=","'","'",",","...","dtype=","[","'int32","'",",","'int32","'",",","'float32","'","]",",","header=None",")",">",">",">","DiG","=","cugraph.Graph","(","directed=True",")",">",">",">","DiG.from_cudf_edgelist","(","M",",","'","0","'",",","'","1","'",")",">",">",">","density","=","G.density","(",")"]
code: def density(self) -> float:
      """
      Compute the density of the graph.
      Density is the measure of how many edges are in the graph versus
      the max number of edges that could be present.
  
      Returns
      -------
      density : float
          Density is the measure of how many edges are in the graph versus
          the max number of edges that could be present.
  
      Examples
      --------
      >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
      ...                   dtype=['int32', 'int32', 'float32'], header=None)
      >>> DiG = cugraph.Graph(directed=True)
      >>> DiG.from_cudf_edgelist(M, '0', '1')
      >>> density = G.density()
  
      """
      if self.is_directed():
          factor = 1
      else:
          factor = 2
  
      num_e = self._Impl.number_of_edges(directed_edges=True)
      num_v = self._Impl.number_of_vertices()
  
      density = (factor * num_e) / (num_v * (num_v - 1))
      return density
  
imports: import numpy
  from .graph_implementation import simpleGraphImpl, simpleDistributedGraphImpl, npartiteGraphImpl
  import cudf
  import dask_cudf
  from cugraph.utilities.utils import import_optional
label_desc: Use image node_id 27 for calling the Graph obj's underlying member method code with example usage: obj.density() and returns: density