7 votes
Accepted

How to perform a depth-first in-order traversal of an expression?

Recursion ...
Mr.Wizard's user avatar
  • 270k
6 votes
Accepted

How to make a postordered ReplaceAll that operates just once per subtree?

Based on my understanding of the question, you want to apply the rule to any expression, provided it wouldn't match any of its subexpressions. You can implement this traversal yourself quite easily ...
Martin Ender's user avatar
  • 8,734
5 votes

How to perform a breadth-first traversal of an expression?

I don't sure this will look as a duplicated version with Sjoerd C. de Vries in here,but there are some trick function can make you life ease and simplify that answer.So I post this answer still. Build ...
yode's user avatar
  • 26.3k
4 votes
Accepted

How to mark leaves of polynomial based on its position in tree

Here's a first attempt, I wouldn't be surprised if a sufficiently complicated monomial group fails to expand under this: First, a helper function: We need to be able to determine the order of a ...
eyorble's user avatar
  • 9,343
3 votes

a function to extract all subexpressions from an expression

Second answer The OP's desired order: ...
Michael E2's user avatar
  • 233k
2 votes

Visiting nodes in a tree bottom up

If it is okay for the properties to be updated in a post-order depth-first traversal, you can use TreeFold: ...
Ian Ford's user avatar
  • 404
1 vote

How to mark leaves of polynomial based on its position in tree

MinimumVertexColoring Constructing an adjacency graph (two variables are adjacent if they appear in the same term in the expansion of the polynomial) and using ...
kglr's user avatar
  • 384k
1 vote

a function to extract all subexpressions from an expression

Your use of the head Inactive[] complicates this a bit, but generally, you'll want to do this: ...
Feyre's user avatar
  • 8,557

Only top scored, non community-wiki answers of a minimum length are eligible