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: 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: 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: 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: 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: SetList[GraphModule]
The sink modules that connect via this
GraphNode
- Type:
SetList[GraphModule]
- source_modules: SetList[GraphModule]
The source modules that connect via this
GraphNode
- Type:
SetList[GraphModule]