Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

cumulative_sum

cumulative_sum(numbers)[source]

Yield cumulative sum of numbers.

>>> import networkx.utils as utils
>>> list(utils.cumulative_sum([1,2,3,4]))
[1, 3, 6, 10]