Optimise treewidth computations (somewhat).

There still is room for improvement by using priority queues
Merge branch 'master' of https://github.com/jkeiren/pginfo