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:
objectDescribe a node connecting
GraphModulesGraphNodes are elements that connect multipleGraphModules. They maintain lists of source and sink modules. Use the methodsadd_source(),add_sink(),remove_source()andremove_sink()to connect and disconnectGraphNodes.See also
For an overview of computational graphs in Rockpool, see Computational graphs in Rockpool.
Attributes overview
The source modules that connect via this
GraphNodeThe sink modules that connect via this
GraphNodeMethods overview
__init__([source_modules, sink_modules])add_sink(sink)Add a
GraphModuleas a sink of thisGraphNodeadd_source(source)Add a
GraphModuleas a source of thisGraphNoderemove_sink(sink)Remove a
GraphModuleas a sink of thisGraphNoderemove_source(source)Remove a
GraphModuleas 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
GraphModuleas a sink of thisGraphNode- Parameters:
sink (GraphModule) – The module to add to this node
- Raises:
ValueError – If
sinkis aGraphHolder.
- add_source(source: GraphModule) None[source]
Add a
GraphModuleas a source of thisGraphNode- Parameters:
source (GraphModule) – The module to add to this node
- Raises:
ValueError – If
sourceis aGraphHolder.
- remove_sink(sink: GraphModule) None[source]
Remove a
GraphModuleas a sink of thisGraphNodeIf
sinkis 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
GraphModuleas a source of thisGraphNodeIf
sourceis 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]