BFSSolver implementation