graphdot.util.iterable module

graphdot.util.iterable.argmax(iterable, less)[source]
graphdot.util.iterable.flatten(iterable)[source]

Iterate through a tree of iterables in depth-first order. E.g. :py:`flatten(((1, 2), 3))` yields the sequence of :py:`1, 2, 3`.

graphdot.util.iterable.fold_like(flat, example)[source]

Create a tree of iterables from an input linear sequence and a structure template. E.g. :py:`fold_like([1, 2, 3], ((None, None), None))` yields :py:`((1, 2), 3)`.

graphdot.util.iterable.replace(iterable, old, new)[source]

Replace all occurrences of old to new.