original_docstring: Compute the degree centrality for nodes in a bipartite network.
  
      The degree centrality for a node v is the fraction of nodes it
      is connected to.
  
      parameters
      ----------
      G : graph
        A networkx graph
  
      Returns
      -------
      nodes : dictionary
         Dictionary of nodes with degree centrality as the value.
  
      Notes
      -----
      The degree centrality are normalized by dividing by n-1 where
      n is number of nodes in G.
      
docstring: Compute the degree centrality for nodes in a bipartite network.
  The degree centrality for a node v is the fraction of nodes it
  is connected to.
  
  parameters
  
  G : graph
  A networkx graph
  
  Returns
  
  nodes : dictionary
  Dictionary of nodes with degree centrality as the value.
  
  Notes
  
  The degree centrality are normalized by dividing by n-1 where
  n is number of nodes in G.
docstring_tokens: Compute the degree centrality for nodes in a bipartite network . The degree centrality for a node v is the fraction of nodes it is connected to . parameters G : graph A networkx graph Returns nodes : dictionary Dictionary of nodes with degree centrality as the value . Notes The degree centrality are normalized by dividing by n - 1 where n is number of nodes in G .
code: def degree_centrality(G):
      """Compute the degree centrality for nodes in a bipartite network.
  
      The degree centrality for a node v is the fraction of nodes it
      is connected to.
  
      parameters
      ----------
      G : graph
        A networkx graph
  
      Returns
      -------
      nodes : dictionary
         Dictionary of nodes with degree centrality as the value.
  
      Notes
      -----
      The degree centrality are normalized by dividing by n-1 where
      n is number of nodes in G.
      """
      if len(G) <= 1:
          return {n: 1 for n in G}
      
      s = 1.0 / (len(G) - 1.0)
      centrality = {n: d * s for n, d in G.degree()}
      return centrality
code_tokens: def degree_centrality ( G ) : if len ( G ) <= 1 : return { n : 1 for n in G } s = 1.0 / ( len ( G ) - 1.0 ) centrality = { n : d * s for n , d in G . degree ( ) } return centrality
short_docstring: Compute the degree centrality for nodes in a bipartite network.
short_docstring_tokens: Compute the degree centrality for nodes in a bipartite network .
comment: """Compute the degree centrality for nodes in a bipartite network.
  
      The degree centrality for a node v is the fraction of nodes it
      is connected to.
  
      parameters
      ----------
      G : graph
        A networkx graph
  
      Returns
      -------
      nodes : dictionary
         Dictionary of nodes with degree centrality as the value.
  
      Notes
      -----
      The degree centrality are normalized by dividing by n-1 where
      n is number of nodes in G.
      """