I'm looking for a library that implements any of the seemingly well documented* strategies for calculating the distance between trees.
For example, the library should show that these two trees
a a
/ \ / \
b c b c
\
d
are more 'similar' than these two
a x
/ \ / \
b c y z
I'm using node.js so a node implementation would be nice. I'm aware that 'similar' seems somewhat ambiguous, but no matter what strategy you would use to compute the difference between these trees, I'm assuming you would always end up with some final 'score' that, if representing an edit distance, would be larger in the second case than in the first.
What node.js libraries do anything like this?
EDIT: Some added info on my specific case: This is for detecting repeating tree structures in html documents, so libraries more specialized to that problem would be even better.
EDIT2: Even a levenshtein distance library for node.js would help so I could at least do comparisons on fingerprint text of the tree.
*I'm new to the field, but scribd.com discusses strategies used by Lu and Tai.