Ekranga berilgan uchlar orasidagi qisqa masofani va uning og’irligini chiqaruvchi;
Quyidagi graf asosida tekshirib ko’ruvchi:
#include using namespace std;
const int maxV=1000;
int i, j, n;
int GR[maxV][maxV];
void FU(int D[][maxV], int V)
{
int k;
for (i=0; ifor (k=0; kfor (i=0; ifor (j=0; jif (D[i][k] && D[k][j] && i!=j)
if (D[i][k]+D[k][j]D[i][j]=D[i][k]+D[k][j];}}}
for (i=0; i{
for (j=0; j cout<} }
int main()
{
setlocale(LC_ALL, "Rus");
cout<<"Graf o'lchami > "; cin>>n;
cout<<"Grafni kiririting:\n";
for (i=0; ifor (j=0; j{
cout<<"GR["< ";
cin>>GR[i][j];
}
cout<<"Eng qisqa yo'l graf matritsasi':"<FU(GR, n);
system("pause>>void");
}