# What is the best technique/algorithm to compare trees changes?

I have a problem I would like to solve using machine learning. I would like to use some sort of classification to know if a just added change in a tree data structure is "good" or is "bad".

Let's say I have this tree:

        (A)
/ \
/   \
(B)   (C)


And I apply a change to it (a "good" change, so the algorithm should associate this change with the "good" changes). The updated tree would be like this:

       (A)
/ \
/   \
(D)   (C)
/
/
(B)


Added a certain node (D) above another node (B) would be classified as a "good" change.

So when I have the learner with the correct data, the algorithm should be able to know that if I add a node of type D above a node of type B, it is a "good" change.

I would like to work with XML files that keeps the tree structure, a simple classifier like a naive bayes would not work, because it wouldn't be able to recognise if a node is added above another one, it only would be able to know that a node has been added.

I don't know how which algorithm/technique I should use and I don't know how I should pass the data to the learner, because the context in this scenario is important.

What is the best technique/algorithm to compare trees changes?