SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
profilerouter.h File Reference

Path-routing primitives over an abstract weighted graph, used by Slice BC's profile-path picker. More...

#include <QString>
#include <QVector>
Include dependency graph for profilerouter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ProfileRouter::Edge
 A single directed weighted edge in the routing graph. More...
 
struct  ProfileRouter::Graph
 The input to ProfileRouter — nodes are 0..nodeCount-1, edges are directed by default and reinterpreted as undirected via Options. More...
 
struct  ProfileRouter::Path
 A single candidate path: ordered node sequence (length N+1) of engine node indices, the user-supplied link IDs joining them (length N — pulled from Edge::linkId at emit time), and the summed weight along the sequence. More...
 
struct  ProfileRouter::Options
 Tunables for a single routing query. More...
 
struct  ProfileRouter::Result
 What the router returns. Empty paths plus non-empty error means an outright failure (e.g. invalid endpoints); empty paths plus empty error means no path was found (disconnected components). More...
 

Namespaces

namespace  ProfileRouter
 

Functions

Result ProfileRouter::enumerateSimplePaths (const Graph &g, int startNode, int endNode, const Options &opts={})
 Enumerates every simple (no-repeated-node) path between startNode and endNode using DFS with backtracking.
 
Result ProfileRouter::kShortestPaths (const Graph &g, int startNode, int endNode, const Options &opts={})
 Yen's k-shortest simple paths from startNode to endNode.
 
Result ProfileRouter::kShortestPathsThrough (const Graph &g, const QVector< int > &waypoints, const Options &opts={})
 Routes through a sequence of waypoints (start → w1 → … → end).
 

Detailed Description

Path-routing primitives over an abstract weighted graph, used by Slice BC's profile-path picker.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

The router operates on a generic Graph struct so it can be unit- tested without a full SWMMModelLayer. Callers (typically MapToolSelectProfile) build a Graph from the model and pick one of two strategies:

  • enumerateSimplePaths: DFS backtracking that returns every simple (no-repeated-node) path between two endpoints, sorted by total weight. Worst-case exponential, so guarded by a max-paths cap and a wall-clock soft cap. Preferred for the profile-plot picker where the user wants to see all topologically distinct routes.
  • kShortestPaths: Yen's k-shortest-simple-paths. Cheaper for "give me the top few"; used internally by kShortestPathsThrough where exhaustive enumeration per segment would explode combinatorially.

Waypoint chaining is supported via kShortestPathsThrough.