Are there good libraries for manipulating trees in javascript? Just to be clear, I am looking for tree as in data structure not display model.
Here are some libraries that you may find helpful:
arboreal.js, a "micro-library for traversing and manipulating tree-like data structures" in node.js and the browser.
buckets, a "complete, fully tested and documented data structure library" that includes BSTs, a heap, and a bunch of other goodies.