I wonder if this works backwards - given a tree could you construct a maze? efficiently?
I wonder if this works backwards - given a tree could you construct a maze? efficiently?
http://bl.ocks.org/mbostock/11357811
I made the paths thin (1px instead of 4px) to make it easier to see the tree on top of the maze. But to avoid the path/wall ambiguity, maybe it’d be better to start the paths 4px wide, transition to 1px, and then transition to the tree layout…
Your idea sounds fantastic - the problem really was with how I perceived the maze (black paths, white walls)
It would be great if you could add more comments to the code, or a simple separate guide for each of the projects. They are all amazing, and I'm sure many would want to learn more.
I guess making a guide for every Gist Mike posts would be quite demanding regarding his output, in the end even his day only 24 has hours.
There are trees for which no rectangular maze exists - for example, any tree with a vertex of degree greater than 4. Or the tree with 4 vertices arranged in a T, which can't be fit into a 2x2 space. If there is such an algorithm, it'll have to account for the possibility that there is no solution, so I wouldn't expect it to be very efficient.