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
sGraphNode
s are elements that connect multipleGraphModule
s. They maintain lists of source and sink modules. Use the methodsadd_source()
,add_sink()
,remove_source()
andremove_sink()
to connect and disconnectGraphNode
s.See also
For an overview of computational graphs in Rockpool, see Computational graphs in Rockpool.
Attributes overview
The source modules that connect via this
GraphNode
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 thisGraphNode
add_source
(source)Add a
GraphModule
as a source of thisGraphNode
remove_sink
(sink)Remove a
GraphModule
as a sink of thisGraphNode
remove_source
(source)Remove a
GraphModule
as a source of thisGraphNode
- __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 thisGraphNode
- Parameters
sink (GraphModule) β The module to add to this node
- Raises
ValueError β If
sink
is aGraphHolder
.
- add_source(source: graph.graph_base.GraphModule) None [source]ο
Add a
GraphModule
as a source of thisGraphNode
- Parameters
source (GraphModule) β The module to add to this node
- Raises
ValueError β If
source
is aGraphHolder
.
- remove_sink(sink: graph.graph_base.GraphModule) None [source]ο
Remove a
GraphModule
as a sink of thisGraphNode
If
sink
is a sink of thisGraphNode
, 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 thisGraphNode
If
source
is a source of thisGraphNode
, 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]