 The algorithm is similar to Dijkstra's algorithm and uses the fact that information only flows outward from the seeding area.This problem is a special case of level-set methods.More general algorithms exist but are normally slower.