
    i`                          S r SS jrSrSS jrg)z
altgraph.GraphStat - Functions providing various graph statistics
=================================================================
c                     / nUS:X  a  U R                   nOU R                  nU  H  nUR                  U" U5      5        M     U(       d  / $ [        XAUS9nU$ )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           ?C:\des-py\RoboSAPF\venv\Lib\site-packages\altgraph/GraphStat.pydegree_distr      s[     Cu}""""

74=!  	c'BGN    g      =c                    US:X  a$  [        U 5      [        -
  [        U 5      [        -   pCOUu  p4XC-
  [        U5      -  nS/U-  nU  H3  n Xs-
  S:  a'  [	        Xs-
  [        U5      -  5      nXh==   S-  ss'   M3  M5     / n	US-  U-   n
[        U5       H  u  pXU-  -   nU	R                  X45        M      U	$ ! [
         a     M}  f = f)z
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%U_h?@q  &  Flg%F$\!qf   M  		s   -B77
CCN)r   
   out)r   r+   )__doc__r   r   r
    r   r   <module>r/      s   < !r   