Closed naoyam closed 1 day ago
!build
Is
BFS(require_all_to_visited=true).getShortestExprPath().first
equivalent to the following?auto pair = BFS(require_all_to_visited=false).getShortestExprPath(); NVF_ERROR(pair.second); return pair.first;
We are not removing this
require_all_to_visited
flag because:
- It is almost always true, and it would be annoying to add the
NVF_ERROR
everywhere we useBFS
, and- It is common for a developer to forget this
NVF_ERROR
, and if this happens, we missed an opportunity to catch a bug.
Yes. I also considered having two separate versions, with require_all_to_visited
being true
or false
so that the former version wouldn't need to do .first
, but I wasn't sure which one would be better.
Just a mechanical change. This makes it a little cumbersome when
require_all_to_visited
is not used, but sometimes we also need to check if all nodes were visited.