8.1.1.13. get_sub_dsp

Dispatcher.get_sub_dsp(nodes_bunch, edges_bunch=None)[source]

Returns the sub-dispatcher induced by given node and edge bunches.

The induced sub-dispatcher contains the available nodes in nodes_bunch and edges between those nodes, excluding those that are in edges_bunch.

The available nodes are non isolated nodes and function nodes that have all inputs and at least one output.

Parameters:
  • nodes_bunch (list[str], iterable) – A container of node ids which will be iterated through once.
  • edges_bunch (list[(str, str)], iterable, optional) – A container of edge ids that will be removed.
Returns:

A dispatcher.

Return type:

Dispatcher

Note

The sub-dispatcher edge or node attributes just point to the original dispatcher. So changes to the node or edge structure will not be reflected in the original dispatcher map while changes to the attributes will.

——————————————————————–

Example:

A dispatcher with a two functions fun1 and fun2:

digraph dmap { graph [ratio=1] node [style=filled] label = <dmap> splines = ortho style = filled 127 [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\""] 128 [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\""] 129 [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\""] 130 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">d</TD></TR></TABLE>> fillcolor=cyan id=4 shape=box style="rounded,filled" tooltip="\"d\""] 131 [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\""] 132 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-ec7fe2fcb79b40c0d32cab458a060887467644f8/fun1-function.html">fun1</TD></TR></TABLE>> fillcolor=springgreen id=0 shape=box tooltip="\"fun1\""] 133 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-ec7fe2fcb79b40c0d32cab458a060887467644f8/fun2-function.html">fun2</TD></TR></TABLE>> fillcolor=springgreen id=5 shape=box tooltip="\"fun2\""] 132 -> 129 132 -> 130 127 -> 132 127 -> 133 128 -> 132 130 -> 133 133 -> 129 133 -> 131 }

Get the sub-dispatcher induced by given nodes bunch:

>>> sub_dsp = dsp.get_sub_dsp(['a', 'c', 'd', 'e', 'fun2'])

digraph dmap { graph [ratio=1] node [style=filled] label = <dmap> splines = ortho style = filled 142 [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\""] 143 [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\""] 144 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2">d</TD></TR></TABLE>> fillcolor=cyan id=4 shape=box style="rounded,filled" tooltip="\"d\""] 145 [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\""] 146 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-b683bc6b4b3e76718b782f327dc5dd15c71d6779/fun2-function.html">fun2</TD></TR></TABLE>> fillcolor=springgreen id=5 shape=box tooltip="\"fun2\""] 142 -> 146 144 -> 146 146 -> 143 146 -> 145 }