Skip to content

Change the cancellation interface #168

@akrzemi1

Description

@akrzemi1

Currently, the users of breadth_first_search view need to type the following in order to break from the view iteration:

for (auto v : bfs)
{
  if (cond)
    bfs.cancel(graph::cancel_search::cancel_branch);
}

This seems unnecessarily long, and rather than exposing a two-state enum in the interface, the view could offer two functions instead:

for (auto v : bfs)
{
  if (cond1)
    bfs.break_branch();

  if (cond2)
    bfs.break_all();
}

And in fact you may not need the second one (break_all) because (a) it is never used, and (b) a more familiar alternative exists:

for (auto v : bfs)
{
  if (cond2)
    break;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions