d3 implementation of a 2-way tree