Add some framework for PathAlgorithm.

@dgearhart @kevinkreiser @gknisely