Prune tree of redundant edges