Skip to content

Make dijkstra_shortest_paths sufficiently generic to solve the "maximum bandwidth path" problem #39

Description

@akrzemi1

By the "maximum bandwidth path" problem I mean finding path between two indicated vertices that maximizes the minimum weight that can be found on the path edges.

This problem can be solved by Dijkstra's Shortest Paths algorigh if we provide:

  1. min for Combine funciton,
  2. greater for Compare funciton
  3. 0 for the maximum possible weight,
  4. numeric_limits<T>::max() for the minimum possible weight.

This Compiler Explorer example shows how this can be done with Boost.Graph.

This cannot be done with graph-v3, though, because it only allows customizing the first two (functions) but not the last two (special values). I cannot easily suggest a fix as it affects the design questions: how many arguments to an algorithm can you afford to have?

Also these forur values need to make sense together. They together form a concept. A concept with semantic constriants:

  • compare(w, min_weight) == false
  • compare(max_weight, w) == false
  • compare(combine(w, v), w) == false
  • compare(w, combine(w, min_weight)) == false
  • compare(max_weight, combine(max_weight, w)) == false

One option is to have these four travel together as one aggregate parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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