44 static void SIP_PYALTERNATIVETYPE( SIP_PYLIST ) dijkstra(
const QgsGraph *source,
int startVertexIdx,
int criterionNum, QVector<int> *resultTree =
nullptr, QVector<double> *resultCost =
nullptr );
48 QVector<int> treeResult;
49 QVector<double> costResult;
52 PyObject *l1 = PyList_New( treeResult.size() );
57 PyObject *l2 = PyList_New( costResult.size() );
63 for ( i = 0; i < costResult.size(); ++i )
65 PyObject *Int = PyLong_FromLong( treeResult[i] );
66 PyList_SET_ITEM( l1, i, Int );
67 PyObject *Float = PyFloat_FromDouble( costResult[i] );
68 PyList_SET_ITEM( l2, i, Float );
71 sipRes = PyTuple_New( 2 );
72 PyTuple_SET_ITEM( sipRes, 0, l1 );
73 PyTuple_SET_ITEM( sipRes, 1, l2 );
83 static QgsGraph *shortestTree(
const QgsGraph *source,
int startVertexIdx,
int criterionNum );
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.