7.1.1.10. 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 82 [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] 83 [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] 84 [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] 85 [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] 86 [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] 87 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-cf28632e9a1c3ff2118ae3a6dc7f1f912abc76c5/fun1-function.html">fun1</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip=fun1] 88 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-cf28632e9a1c3ff2118ae3a6dc7f1f912abc76c5/fun2-function.html">fun2</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip=fun2] 88 -> 84 87 -> 85 82 -> 87 88 -> 86 87 -> 84 85 -> 88 82 -> 88 83 -> 87 }

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 97 [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] 98 [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] 99 [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] 100 [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] 101 [label=<<TABLE border="0" cellspacing="0"><TR><TD border="0" colspan="2" href="./dispatcher-7ddcc5d67e9a008b8aefaa9fe16ccafecfc0f2a0/fun2-function.html">fun2</TD></TR></TABLE>> fillcolor=springgreen shape=box tooltip=fun2] 101 -> 98 97 -> 101 101 -> 100 99 -> 101 }