Implemented BFS with strategy pattern.