7.1.1.16. shrink_dsp

Dispatcher.shrink_dsp(inputs=None, outputs=None, cutoff=None, inputs_dist=None, wildcard=True)[source]

Returns a reduced dispatcher.

Parameters:
  • inputs (list[str], iterable, optional) – Input data nodes.
  • outputs (list[str], iterable, optional) – Ending data nodes.
  • cutoff (float, int, optional) – Depth to stop the search.
  • inputs_dist (dict[str, int | float], optional) – Initial distances of input data nodes.
  • wildcard (bool, optional) – If True, when the data node is used as input and target in the ArciDispatch algorithm, the input value will be used as input for the connected functions, but not as output.
Returns:

A sub-dispatcher.

Return type:

Dispatcher

See also

dispatch()

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

Example:

A dispatcher like this:

digraph dmap { graph [ratio=1] node [style=filled] label = <dmap> splines = ortho style = filled 149 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">a</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=a] 150 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">b</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=b] 151 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">c</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=c] 152 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">d</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=d] 153 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">e</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=e] 154 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">f</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=f] 155 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-d6b3fb0daf47d40e912db57cc7135de25f4d204b/fun1-function.html">fun1</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip=fun1] 156 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-d6b3fb0daf47d40e912db57cc7135de25f4d204b/fun2-function.html">fun2</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip=fun2] 157 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-d6b3fb0daf47d40e912db57cc7135de25f4d204b/min.html">fun3</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip="min(iterable, *[, default=obj, key=func]) -> value"] 158 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-d6b3fb0daf47d40e912db57cc7135de25f4d204b/max.html">fun4</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip="max(iterable, *[, default=obj, key=func]) -> value"] 159 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-d6b3fb0daf47d40e912db57cc7135de25f4d204b/max-0.html">fun5</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip="max(iterable, *[, default=obj, key=func]) -> value"] 160 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">g</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=g] 150 -> 155 159 -> 154 154 -> 157 158 -> 160 152 -> 156 149 -> 158 150 -> 156 152 -> 159 153 -> 159 149 -> 155 159 -> 151 150 -> 158 156 -> 153 152 -> 157 157 -> 160 155 -> 151 }

Get the sub-dispatcher induced by dispatching with no calls from inputs a, b, and c to outputs c, e, and f:

>>> shrink_dsp = dsp.shrink_dsp(inputs=['a', 'b', 'd'],
...                             outputs=['c', 'f'])

digraph dmap { graph [ratio=1] node [style=filled] label = <dmap> splines = ortho style = filled 177 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">a</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=a] 178 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">b</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=b] 179 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">c</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=c] 180 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">d</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=d] 181 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">e</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=e] 182 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">f</TD></TR></TABLE>> fillcolor=cyan shape=box style="rounded,filled" tooltip=f] 183 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-5f0fb3bb7bc095944a751068eaa9c5408362c207/fun1-function.html">fun1</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip=fun1] 184 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-5f0fb3bb7bc095944a751068eaa9c5408362c207/fun2-function.html">fun2</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip=fun2] 185 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-5f0fb3bb7bc095944a751068eaa9c5408362c207/max.html">fun5</TD></TR><TR><TD align="RIGHT" border="1">M_outputs</TD><TD align="LEFT" border="1">(&#x27;c&#x27;,)</TD></TR></TABLE>> fillcolor=orange shape=box tooltip="max(iterable, *[, default=obj, key=func]) -> value"] 178 -> 183 185 -> 182 184 -> 181 183 -> 179 180 -> 184 177 -> 183 178 -> 184 180 -> 185 181 -> 185 }