Skip collapsed arcs when pruning.

Also, add tests for pruning.