Partial subtree-matching algorithm
I searched the forums but I couldn't figure it out if the other similar questions are necessarily related to this one. What I'm trying to do is match a subtree to a tree of objects. I know there are pattern matching algorithms based on suffix trees or automata, but I'm not sure whether they apply here. I am trying to match the subtree given by the red nodes in the picture against the bigger tree, regardless of the overall structure of the tree or whether the red nodes have children or not. The reason straightforward pattern matching does not work is that no ordering of the nodes (post/preorder