Better matching

Created shortest paths and a naive greedy implementation for matching.