symbolic_dynamics.sofic.from_partial_fns

symbolic_dynamics.sofic.from_partial_fns(pfns)[source]

Returns a deterministic graph built from given partial functions.

Here, pfns is a dict of dicts: the keys of the outer dicts are labels to be used in the output graph, and the inner dicts represent where the edges for a given label are located.

More specifically, if G is the result of from_partial_fns(pfns), then G has the following property:

>>> for (a, pfn) in pfns.items():
...     for q in G:
...         if q in pfn:
...              assert dot(G, q, [a]) == pfn[q]
...         else:
...              assert dot(G, q, [a]) is None
Parameters
pfnsdict of dicts; see above

Examples

>>> d = {"a": {0: 1, 1: 2, 2: 3}, "b": {3: 0, 0: 3}}
>>> G = sd.from_partial_fns(d)
>>> list(G.edges(data="label"))
[(0, 1, 'a'), (0, 3, 'b'), (1, 2, 'a'), (2, 3, 'a'), (3, 0, 'b')]