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
Go to the documentation of this file.
1
29#ifndef PROFILE_ROUTER_H
30#define PROFILE_ROUTER_H
31
32#include <QString>
33#include <QVector>
34
36{
37
45struct Edge
46{
47 int fromNode = -1;
48 int toNode = -1;
49 double weight = 0.0;
50 int linkId = -1;
51};
52
58struct Graph
59{
60 int nodeCount = 0;
61 QVector<Edge> edges;
62};
63
79struct Path
80{
81 QVector<int> nodes;
82 QVector<int> linkIds;
83 double weight = 0.0;
84
85 [[nodiscard]] bool isEmpty() const { return linkIds.isEmpty(); }
86};
87
92struct Options
93{
95 int k = 5;
96
102 int maxPaths = 10000;
103
105 bool undirected = false;
106
110 int softCapMs = 200;
111
115 int maxIterations = 100000;
116};
117
125struct Result
126{
127 QVector<Path> paths;
128 bool truncated = false;
129 QString error;
130};
131
152[[nodiscard]] Result enumerateSimplePaths(const Graph &g,
153 int startNode,
154 int endNode,
155 const Options &opts = {});
156
165[[nodiscard]] Result kShortestPaths(const Graph &g,
166 int startNode,
167 int endNode,
168 const Options &opts = {});
169
178[[nodiscard]] Result kShortestPathsThrough(const Graph &g,
179 const QVector<int> &waypoints,
180 const Options &opts = {});
181
182} // namespace ProfileRouter
183
184#endif // PROFILE_ROUTER_H
Definition profilerouter.h:36
Result kShortestPaths(const Graph &g, int startNode, int endNode, const Options &opts={})
Yen's k-shortest simple paths from startNode to endNode.
Definition profilerouter.cpp:306
Result kShortestPathsThrough(const Graph &g, const QVector< int > &waypoints, const Options &opts={})
Routes through a sequence of waypoints (start → w1 → … → end).
Definition profilerouter.cpp:416
Result 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 backtrac...
Definition profilerouter.cpp:148
A single directed weighted edge in the routing graph.
Definition profilerouter.h:46
int fromNode
Definition profilerouter.h:47
int linkId
Definition profilerouter.h:50
double weight
Definition profilerouter.h:49
int toNode
Definition profilerouter.h:48
The input to ProfileRouter — nodes are 0..nodeCount-1, edges are directed by default and reinterprete...
Definition profilerouter.h:59
int nodeCount
Definition profilerouter.h:60
QVector< Edge > edges
Definition profilerouter.h:61
Tunables for a single routing query.
Definition profilerouter.h:93
int maxPaths
Definition profilerouter.h:102
int k
Definition profilerouter.h:95
bool undirected
Definition profilerouter.h:105
int softCapMs
Definition profilerouter.h:110
int maxIterations
Definition profilerouter.h:115
A single candidate path: ordered node sequence (length N+1) of engine node indices,...
Definition profilerouter.h:80
QVector< int > linkIds
Definition profilerouter.h:82
QVector< int > nodes
Definition profilerouter.h:81
bool isEmpty() const
Definition profilerouter.h:85
double weight
Definition profilerouter.h:83
What the router returns. Empty paths plus non-empty error means an outright failure (e....
Definition profilerouter.h:126
QVector< Path > paths
Definition profilerouter.h:127
bool truncated
Definition profilerouter.h:128
QString error
Definition profilerouter.h:129