graph.GraphNode

class graph.GraphNode(source_modules: graph.graph_base.SetList[graph.graph_base.GraphModule] = <factory>, sink_modules: graph.graph_base.SetList[graph.graph_base.GraphModule] = <factory>)[source]

Bases: object

Describe a node connecting GraphModule s

GraphNode s are elements that connect multiple GraphModule s. They maintain lists of source and sink modules. Use the methods add_source(), add_sink(), remove_source() and remove_sink() to connect and disconnect GraphNode s.

See also

For an overview of computational graphs in Rockpool, see Computational graphs in Rockpool.

__init__(source_modules: graph.graph_base.SetList[graph.graph_base.GraphModule] = <factory>, sink_modules: graph.graph_base.SetList[graph.graph_base.GraphModule] = <factory>) None

Attributes overview

source_modules

The source modules that connect via this GraphNode

sink_modules

The sink modules that connect via this GraphNode

Methods overview

__init__([source_modules,Β sink_modules])

add_sink(sink)

Add a GraphModule as a sink of this GraphNode

add_source(source)

Add a GraphModule as a source of this GraphNode

remove_sink(sink)

Remove a GraphModule as a sink of this GraphNode

remove_source(source)

Remove a GraphModule as a source of this GraphNode

__init__(source_modules: graph.graph_base.SetList[graph.graph_base.GraphModule] = <factory>, sink_modules: graph.graph_base.SetList[graph.graph_base.GraphModule] = <factory>) None
add_sink(sink: graph.graph_base.GraphModule) None[source]

Add a GraphModule as a sink of this GraphNode

Parameters

sink (GraphModule) – The module to add to this node

Raises

ValueError – If sink is a GraphHolder.

add_source(source: graph.graph_base.GraphModule) None[source]

Add a GraphModule as a source of this GraphNode

Parameters

source (GraphModule) – The module to add to this node

Raises

ValueError – If source is a GraphHolder.

remove_sink(sink: graph.graph_base.GraphModule) None[source]

Remove a GraphModule as a sink of this GraphNode

If sink is a sink of this GraphNode, it will be removed.

Parameters

sink (GraphModule) – The module to remove from this node

remove_source(source: graph.graph_base.GraphModule) None[source]

Remove a GraphModule as a source of this GraphNode

If source is a source of this GraphNode, it will be removed.

Parameters

source (GraphModule) – The module to remove from this node

sink_modules: graph.graph_base.SetList[graph.graph_base.GraphModule]

The sink modules that connect via this GraphNode

Type

SetList[GraphModule]

source_modules: graph.graph_base.SetList[graph.graph_base.GraphModule]

The source modules that connect via this GraphNode

Type

SetList[GraphModule]