Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small bugs in 3.3.1.2 (Breadth-First Search, Single Source) #68

Open
akrzemi1 opened this issue Jan 20, 2024 · 0 comments
Open

Small bugs in 3.3.1.2 (Breadth-First Search, Single Source) #68

akrzemi1 opened this issue Jan 20, 2024 · 0 comments

Comments

@akrzemi1
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant