iter_node

Contents

iter_node#

class brainstate.graph.iter_node(node, allowed_hierarchy=(0, 2147483647))#

Iterate (path, graph_node) over every graph node in the graph.

Repeated nodes are visited only once (by identity).

Parameters:
  • node (Any) – The root graph node or pytree.

  • allowed_hierarchy (tuple[int, int]) – (lo, hi) graph-node depth bounds.

Yields:

tuple of (PathParts, Any) – The path to, and the object of, each graph node.