PathMatcher API additions

This adds two new methods which should be sufficient for David to optimise some of the Caribou internals, as discussed in #1076.