ADDED: BFS_matching function

finds non-symmetric permutation that makes all diagonal elements
nonzero, as long as matrix is not singular