43 static void SIP_PYALTERNATIVETYPE( SIP_PYLIST ) dijkstra(
const QgsGraph *source,
int startVertexIdx,
int criterionNum, QVector<int> *resultTree =
nullptr, QVector<double> *resultCost =
nullptr );
47 QVector<int> treeResult;
48 QVector<double> costResult;
51 PyObject *l1 = PyList_New( treeResult.size() );
56 PyObject *l2 = PyList_New( costResult.size() );
62 for ( i = 0; i < costResult.size(); ++i )
64 PyObject *Int = PyLong_FromLong( treeResult[i] );
65 PyList_SET_ITEM( l1, i, Int );
66 PyObject *Float = PyFloat_FromDouble( costResult[i] );
67 PyList_SET_ITEM( l2, i, Float );
70 sipRes = PyTuple_New( 2 );
71 PyTuple_SET_ITEM( sipRes, 0, l1 );
72 PyTuple_SET_ITEM( sipRes, 1, l2 );
82 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.