QgsGraphAnalyzer class
This class performs graph analysis, e.g.
Contents
- Reference
calculates shortest path between two points using different strategies with Dijkstra algorithm
Public static functions
- static void dijkstra(const QgsGraph* source, int startVertexIdx, int criterionNum, QVector<int>* resultTree = nullptr, QVector<double>* resultCost = nullptr)
- Solve shortest path problem using Dijkstra algorithm.
- static auto shortestTree(const QgsGraph* source, int startVertexIdx, int criterionNum) -> QgsGraph*
- Returns shortest path tree with root-node in startVertexIdx.
Function documentation
static void QgsGraphAnalyzer:: dijkstra(const QgsGraph* source,
int startVertexIdx,
int criterionNum,
QVector<int>* resultTree = nullptr,
QVector<double>* resultCost = nullptr)
Solve shortest path problem using Dijkstra algorithm.
| Parameters | |
|---|---|
| source | source graph |
| startVertexIdx | index of the start vertex |
| criterionNum | index of the optimization strategy |
| resultTree | array that represents shortest path tree. resultTree[ vertexIndex ] == inboundingArcIndex if vertex reachable, otherwise resultTree[ vertexIndex ] == -1. Note that the startVertexIdx will also have a value of -1 and may need special handling by callers. |
| resultCost | array of the paths costs |
static QgsGraph* QgsGraphAnalyzer:: shortestTree(const QgsGraph* source,
int startVertexIdx,
int criterionNum)
Returns shortest path tree with root-node in startVertexIdx.
| Parameters | |
|---|---|
| source | source graph |
| startVertexIdx | index of the start vertex |
| criterionNum | index of the optimization strategy |