.. role:: ts-api-decorator

.. _TreeWalkMode:

############
TreeWalkMode
############

.. container:: ts-api-section

   Possible modes to use when performing operations which allow for customization of the way the
   model tree is walked.



.. container:: api-index-section

   .. rubric:: Enumeration Members

   .. rst-class:: api-index-list-item api-kind-enummember api-parent-kind-enum

   * :ref:`TreeWalkMode.Default`
   * :ref:`TreeWalkMode.PerNode`





------------

Enumeration Members
===================

.. rst-class:: ts-api-section

.. _TreeWalkMode.Default:

Default
-------

The default tree walk mode which visits every node starting from the root.

This mode will work in the general case, but may prove to be less performant when
operating on large trees.

.. rst-class:: ts-api-section

.. _TreeWalkMode.PerNode:

PerNode
-------

Perform multiple synchronous walks beginning at each node passed into the function.

This optimized mode mode can speed up performance by greatly reducing the amount of nodes
that need to be walked for large model trees. Use this mode if the nodes you are
operating on are contained in distict subtrees, or primarily leaf nodes.

Note that if the input contains nodes which are in the same subtree, but contain
conflicting values, this method may produce undesirable results, and the default method
should be used instead.

