ADDED: weighted bfs matching