created a naive greedy version for matchPerfect
using the shortest paths