MCPcopy
hub / github.com/networkx/networkx / cumulative_distribution

Function cumulative_distribution

networkx/utils/random_sequence.py:130–138  ·  view source on GitHub ↗

Returns normalized cumulative distribution from discrete distribution.

(distribution)

Source from the content-addressed store, hash-verified

128
129
130def cumulative_distribution(distribution):
131 """Returns normalized cumulative distribution from discrete distribution."""
132
133 cdf = [0.0]
134 cumulative = 0.0
135 for element in distribution:
136 cumulative += element
137 cdf.append(cumulative)
138 return [element / cumulative for element in cdf]
139
140
141@py_random_state(3)

Callers 3

random_referenceFunction · 0.90
lattice_referenceFunction · 0.90
discrete_sequenceFunction · 0.85

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…