8.1.1.18. 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 194 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">a</TD></TR></TABLE>> fillcolor=cyan id=1 shape=box style="rounded,filled" tooltip="\"a\""] 195 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">b</TD></TR></TABLE>> fillcolor=cyan id=2 shape=box style="rounded,filled" tooltip="\"b\""] 196 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">c</TD></TR></TABLE>> fillcolor=cyan id=3 shape=box style="rounded,filled" tooltip="\"c\""] 197 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">d</TD></TR></TABLE>> fillcolor=cyan id=5 shape=box style="rounded,filled" tooltip="\"d\""] 198 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">e</TD></TR></TABLE>> fillcolor=cyan id=6 shape=box style="rounded,filled" tooltip="\"e\""] 199 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">f</TD></TR></TABLE>> fillcolor=cyan id=8 shape=box style="rounded,filled" tooltip="\"f\""] 200 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-088386b95d58322d1379018d7fd052910d84eab5/fun1-function.html">fun1</TD></TR></TABLE>> fillcolor=springgreen id=0 shape=box tooltip="\"fun1\""] 201 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-088386b95d58322d1379018d7fd052910d84eab5/fun2-function.html">fun2</TD></TR></TABLE>> fillcolor=springgreen id=4 shape=box tooltip="\"fun2\""] 202 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-088386b95d58322d1379018d7fd052910d84eab5/min.html">fun3</TD></TR></TABLE>> fillcolor=springgreen id=7 shape=box tooltip="\"min(iterable, *[, default=obj, key=func]) -> value\""] 203 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-088386b95d58322d1379018d7fd052910d84eab5/max.html">fun4</TD></TR></TABLE>> fillcolor=springgreen id=10 shape=box tooltip="\"max(iterable, *[, default=obj, key=func]) -> value\""] 204 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-088386b95d58322d1379018d7fd052910d84eab5/max-0.html">fun5</TD></TR></TABLE>> fillcolor=springgreen id=11 shape=box tooltip="\"max(iterable, *[, default=obj, key=func]) -> value\""] 205 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">g</TD></TR></TABLE>> fillcolor=cyan id=9 shape=box style="rounded,filled" tooltip="\"g\""] 200 -> 196 194 -> 200 194 -> 203 195 -> 200 195 -> 201 195 -> 203 201 -> 198 197 -> 201 197 -> 202 197 -> 204 198 -> 204 202 -> 205 199 -> 202 203 -> 205 204 -> 196 204 -> 199 }

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 222 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">a</TD></TR></TABLE>> fillcolor=cyan id=1 shape=box style="rounded,filled" tooltip="\"a\""] 223 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">b</TD></TR></TABLE>> fillcolor=cyan id=2 shape=box style="rounded,filled" tooltip="\"b\""] 224 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">c</TD></TR></TABLE>> fillcolor=cyan id=3 shape=box style="rounded,filled" tooltip="\"c\""] 225 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">d</TD></TR></TABLE>> fillcolor=cyan id=5 shape=box style="rounded,filled" tooltip="\"d\""] 226 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">e</TD></TR></TABLE>> fillcolor=cyan id=6 shape=box style="rounded,filled" tooltip="\"e\""] 227 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">f</TD></TR></TABLE>> fillcolor=cyan id=8 shape=box style="rounded,filled" tooltip="\"f\""] 228 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-2963152d95f497c5f1dc1ea4f3bce5176adbc5bd/fun1-function.html">fun1</TD></TR></TABLE>> fillcolor=springgreen id=0 shape=box tooltip="\"fun1\""] 229 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-2963152d95f497c5f1dc1ea4f3bce5176adbc5bd/fun2-function.html">fun2</TD></TR></TABLE>> fillcolor=springgreen id=4 shape=box tooltip="\"fun2\""] 230 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-2963152d95f497c5f1dc1ea4f3bce5176adbc5bd/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 id=11 shape=box tooltip="\"max(iterable, *[, default=obj, key=func]) -> value\""] 228 -> 224 230 -> 227 222 -> 228 223 -> 228 223 -> 229 225 -> 230 225 -> 229 226 -> 230 229 -> 226 }