IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python function

nodes

nodes()

max.experimental.tree_utils.nodes(tree, node_type, *, leaf=None, shared=False)

source

Returns every node_type value inside tree, keyed by its path.

The root matches at path "".

Parameters:

  • tree (Any) – The value to walk.
  • node_type (type[_T] | tuple[type[_T], ...]) – The type, or tuple of types, to report.
  • leaf (type | tuple[type, ...] | Callable[[Any], bool] | None) – Where the walk stops.
  • shared (bool) – Whether a value reachable twice is reported once.

Returns:

{path: node} in the order the walk found them.

Return type:

dict[str, _T]