https://github.com/mbostock/d3/blob/master/src/layout/cluster.js#L28-38
There's similar code for the tree layout, but it's a bit more
complicated due to the tidy algorithm:
https://github.com/mbostock/d3/blob/master/src/layout/tree.js#L110-123
This is a common feature request, and I'd like to support it. I think
we just need to decide what the right API should be for specifying the
layout's "size"; in this case, we want to specify a fixed node size
rather than the size for the entire layout. For example, one option
might be to set the layout's size to null, which would result in each
node being sized as 1x1. Then, you could scale this to the desired
size when displaying the layout.
Mike
Correct, but it'd be reasonable to add one or more method to
d3.layout.hierarchy to return the extent of the tree.
Mike