16 #ifndef QGSGRAPHANALYZER_H 17 #define QGSGRAPHANALYZER_H 22 #include "qgis_analysis.h" 45 static void SIP_PYALTERNATIVETYPE( SIP_PYLIST ) dijkstra(
const QgsGraph *source,
int startVertexIdx,
int criterionNum, QVector<int> *resultTree =
nullptr, QVector<double> *resultCost =
nullptr );
49 QVector< int > treeResult;
50 QVector< double > costResult;
53 PyObject *l1 = PyList_New( treeResult.size() );
58 PyObject *l2 = PyList_New( costResult.size() );
64 for ( i = 0; i < costResult.size(); ++i )
66 PyObject *Int = PyLong_FromLong( treeResult[i] );
67 PyList_SET_ITEM( l1, i, Int );
68 PyObject *Float = PyFloat_FromDouble( costResult[i] );
69 PyList_SET_ITEM( l2, i, Float );
72 sipRes = PyTuple_New( 2 );
73 PyTuple_SET_ITEM( sipRes, 0, l1 );
74 PyTuple_SET_ITEM( sipRes, 1, l2 );
84 static QgsGraph *shortestTree(
const QgsGraph *source,
int startVertexIdx,
int criterionNum );
87 #endif // QGSGRAPHANALYZER_H This class performs graph analysis, e.g.
Mathematical graph representation.
#define SIP_PYALTERNATIVETYPE(type)
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.