Fixed adjacency block problems, 2D grid generation and added tree layout toggle

I think that the way the adjacency functions are called might have changed at some point, because there were inconsistencies in their bodies that were causing errors. I've mad small changes to fix these issues, and done a bit of testing to make sure I haven't ruined everything. As far as I can tell all four of these blocks now work as intended. This resolves #226 and resolves #227. 

The 2D generator now works. Resolves #225 

I've added a tree layout button, but the layout itself doesn't display anything yet. 
(I couldn't figure out how to make a pull request without including this, sorry)
I recommend keeping the old comparison, because then NaNs will also remove the edge. Also, you shouldn't use `==` for comparisons in JavaScript, because it ignores types: https://stackoverflow.com/questions/359494/does-it-matter-which-equals-operator-vs-i-use-in-javascript-comparisons