caesar0301 / treelib

An efficient implementation of tree data structure in python 2/3.
http://treelib.readthedocs.io/en/latest/
Other
801 stars 185 forks source link

Node sorting during tree traversal made optional #103

Closed cowo78 closed 5 years ago

cowo78 commented 5 years ago

Added an optional 'sorting' parameter to Tree.expand_tree() so that tree traversal can be operated without sorting nodes. Parameter defaults to True (sorting enabled) in order to keep backward compatibility. Rationale: if children sorting is always enabled it's impossible to traverse the tree preserving the original insertion order or, better, it is necessary to explicitly keep track of insertion order using other attributes.