6.4.2.15. remove_cyclesΒΆ

Dispatcher.remove_cycles(sources)[source]

Returns a new dispatcher removing unresolved cycles.

An unresolved cycle is a cycle that cannot be removed by the ArciDispatch algorithm.

Parameters:sources (list[str], iterable) – Input data nodes.
Returns:A new dispatcher without the unresolved cycles.
Return type:Dispatcher

***********************************************************************

Example:

A dispatcher with an unresolved cycle (i.e., c –> min1 –> d –> min2 –> c):

The dispatch stops on data node c due to the unresolved cycle:

>>> res = dsp.dispatch(inputs={'a': 1})
>>> sorted(res.items())
[('a', 1), ('b', 3)]

Removing the unresolved cycle the dispatch continues to all nodes:

>>> dsp_rm_cy = dsp.remove_cycles(['a', 'b'])
>>> res = dsp_rm_cy.dispatch(inputs={'a': 1})
>>> sorted(res.items())
[('a', 1), ('b', 3), ('c', 3.0), ('d', 1)]