Алгоритм Дейкстра
if ((QI[i]+QI[j] == 1)&&
(QI[i]*QI[j] == 0)&&
(weigh[i*n+j] != (-1.0))&&
(((QI[i] == 1)&&((L[i]+weigh[i*n+j]) < L[j]))||
((QI[j] == 1)&&((L[j]+weigh[i*n+j]) < L[i])))){
if (QI[i] == 1){
L[j]=L[i]+weigh[i*n+j];
Q[j]=i;
}
else{
L[i]=L[j]+weigh[i*n+j];
Q[i]=j;
}
}
}
}
for (tmp=DBL_MAX,i=0; i < n; i++){
if ((tmp > L[i])&&(QI[i] == 0)){
tmp=L[i];
j=i;
}
}
QI[j]=1;
}
free(QI);