
    Oh`                         d Z ddZdZddZy)z
altgraph.GraphStat - Functions providing various graph statistics
=================================================================
c                     g }|dk(  r| j                   }n| j                  }| D ]  }|j                   ||              |sg S t        |||      }|S )a:  
    Computes the degree distribution for a graph.

    Returns a list of tuples where the first element of the tuple is the
    center of the bin representing a range of degrees and the second element
    of the tuple are the number of nodes with the degree falling in the range.

    Example::

        ....
    inc)valueslimitsbin_num)
inc_degree
out_degreeappend_binning)graphr   r   modedegget_degnoderesultss           d/mnt/c/Users/Administrator/Desktop/help_/test_env/lib/python3.12/site-packages/altgraph/GraphStat.pydegree_distr      sb     Cu}"""" "

74=!" 	c&'BGN    g      =c                    |dk(  r%t        |       t        z
  t        |       t        z   }}n|\  }}||z
  t        |      z  }dg|z  }| D ]2  }	 ||z
  dk\  r't	        ||z
  t        |      z        }||xx   dz  cc<   4 g }	|dz  |z   }
t        |      D ]   \  }}|
||z  z   }|	j                  ||f       " |	S # t
        $ r Y zw xY w)a  
    Bins data that falls between certain limits, if the limits are (0, 0) the
    minimum and maximum values are used.

    Returns a list of tuples where the first element of the tuple is the
    center of the bin and the second element of the tuple are the counts.
        r   r         )min_EPSmaxfloatint
IndexError	enumerater	   )r   r   r   min_valmax_valbin_sizebinsvalueindexresultcenteriyxs                 r   r
   r
   (   s     v;-s6{T/A! '!U7^3H3'?D  	A%UW_h?@Uq 	 Flg%F$ 1X\!q!f M  		s   /B88	CCN)r   
   out)r   r+   )__doc__r   r   r
    r   r   <module>r/      s   < !r   