In P1709r5, in 3.3.1.2 (Breadth-First Search, Single Source):
One. The declaration of the function uses name seed for the start-point vertex, whereas the English description uses name source.
Two: preconditions say:
distances/predecessors will be initialized with init_breadth_first_search.
The usage of the future tense makes it sound as if these were guarantees/postconditions. I recommend rephrasing it to:
the value of distances is the resut of the call to init_breadth_first_search(distances).
Three: It lists 0 <= source < num_vertices(graph) as a precondition and at the same time guarantees that it throws an excepiton upon this condiiton. This is an error: you either need to say that it is a precondition, and you guarantee nothing (because the implementation should be allowed to put an assert there to stop the program, or produce a core dump, or launch a debugger), or you say that bad source is allowed, and then you guarantee that you throw an error and not try to do things like detecting bugs.
Granted that the Standard has places where we say something is a precondition and then we throw, but these are bugs that we now try to avoid.
Four: function breadth_first_search is absent from graph-v2. graph-v2 only has BFS views.
In P1709r5, in 3.3.1.2 (Breadth-First Search, Single Source):
One. The declaration of the function uses name
seed
for the start-point vertex, whereas the English description uses namesource
.Two: preconditions say:
The usage of the future tense makes it sound as if these were guarantees/postconditions. I recommend rephrasing it to:
Three: It lists
0 <= source < num_vertices(graph)
as a precondition and at the same time guarantees that it throws an excepiton upon this condiiton. This is an error: you either need to say that it is a precondition, and you guarantee nothing (because the implementation should be allowed to put anassert
there to stop the program, or produce a core dump, or launch a debugger), or you say that badsource
is allowed, and then you guarantee that you throw an error and not try to do things like detecting bugs.Granted that the Standard has places where we say something is a precondition and then we throw, but these are bugs that we now try to avoid.
Four: function
breadth_first_search
is absent from graph-v2. graph-v2 only has BFS views.