Yield cumulative sum of numbers.
>>> import networkx.utils as utils >>> list(utils.cumulative_sum([1,2,3,4])) [1, 3, 6, 10]