dm.iter 1.0

Relation utilities

These utilies are implemented in dm.iter.relation.

The relation is represented by a map from an element to an
iterator of its directly related elements.
The map is either an object with __getitem__ method,
a callable raising ValueError for undefined
input arguments or an object supporting subscription.
Elements must be allowed as set elements.

Available utilies are depth_first_search and breath_first_search.
They take as arguments a relation and an element iterator ”roots”
and generate the relation’s transitive closure for ”roots”
in depth first or breath first order, respectively.

Lets look at a trivial example. Our relation has the integers between
0 and 11 as domain and maps an element to three times this element.