Flexible path finding in 2d or given a adjacency matrix/list/...