Implemented Tarjan's algorithm for removing dead-end nodes.

 - Previous two pass algorithm didn't work in all cases.
 - Tarjan's is a single pass, and ~2x the speed.
Merge pull request #235 from rodneyodonnell/master

Implemented Tarjan's algorithm for removing dead-end nodes. Replacing old two-pass algorithm.