* \fn bool dijkstraAlgorithm(int startIndex, int endIndex, const QList<T> elements, QList<T> &elementPath, double(*distance)(const T &t1, const T &t2))
* Calculates the shortest path between the elements stored in \a elements.
* The \l {Dijkstra Algorithm} is used to find the shorest path.
* Stores the result inside \a elementPath when sucessfull.
* The function handle \a distance is used to calculate the distance between two elements. The distance must be positive.
* Returns \c true if successful, \c false else.
*
* \sa QList
*/
template<typenameT>
booldijkstraAlgorithm(constQList<T>elements,intstartIndex,intendIndex,QList<T>&elementPath,double(*distance)(constT&t1,constT&t2))// don't seperate parameters with new lines or documentation will break
{
if(elements.isEmpty()||startIndex<0
||startIndex>=elements.size()||endIndex<0
||endIndex>=elements.size()){
returnfalse;
}
// Each element of type T gets stuff into a Node
/// @param distance is the distance between the Node and it's predecessor