Rework addBorderSegments

Move addBorderSegments to before the ordering phase, which should make
the algorithm much simpler. Later if we need to optimize this we can
move it back - but then we have a model to test against.

We still need to add some new tests for the new version of
addBorderSegments and there is some cleanup to be done (e.g. to remove
minRank / maxRank from the ordering phase).
Some fixes to subgraph ordering

Definitely need to get some better tests in for this. We still have a
problem with sorting the initial rank.
initOrder now respects constraints

Still need to fill in tests and doc for this...