zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
U
K±dbã@s dZd
dd„ZdZd dd„Zd    S) z…
altgraph.GraphStat - Functions providing various graph statistics
=================================================================
©éré
ÚoutcCsLg}|dkr|j}n|j}|D]}| ||ƒ¡q|s:gSt|||d}|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)Z
inc_degreeZ
out_degreeÚappendÚ_binning)ÚgraphrrÚmodeÚdegZget_degÚnodeÚresults©rúId:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\altgraph/GraphStat.pyÚ degree_dists rgð=c    CsÚ|dkr$t|ƒtt|ƒt}}n|\}}||t|ƒ}dg|}|D]N}z4||dkr€t||t|ƒƒ}||d7<WqJtk
r–YqJXqJg}    |d|}
t|ƒD]"\} } |
|| } |     | | f¡q²|    S)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.
    rréé)ÚminÚ_EPSÚmaxÚfloatÚintÚ
IndexErrorÚ    enumerater    )rrrZmin_valZmax_valZbin_sizeZbinsÚvalueÚindexÚresultÚcenterÚiÚyÚxrrrr
(s$
   r
N)rrr)rr)Ú__doc__rrr
rrrrÚ<module>s