backward path search alg