Descompunerea in componente tare conexe a unui graf orientat

Descompunerea in componente tare conexe a unui graf orientat, dat prin matricea de adiacenta Matricea de adiacenta se citeste dintr-un fisier text #include <fstream.h>int s[20],p[20],a[20][20],n,nr,i,j;void df1(int nod){int k;s[nod]=nr;for(k=1;k<=n;k++) if ((a[nod][k]==1)…

Continue ReadingDescompunerea in componente tare conexe a unui graf orientat

graf orientat tare conex

  Graf orientat tare conex   #include<fstream.h>#include<conio.h>int s[50],a[50][50],n,suc[50],pred[50],i,j;void citire(char fis[20],int a[50][50],int&n){ fstream f(fis,ios::in); int i,j; f>>n; while(f>>i>>j) a[i][j]=1; f.close();}void df1 (int nod){ int k; suc[nod]=i; for (k=1;k<=n;k++) if ((a[nod][k]==1) &&…

Continue Readinggraf orientat tare conex

roy floyd-grafuri orientate

#include<fstream.h>#include<conio.h>const float pinf=1.e20;float a[50][50];int n; void citire(char nume[20],float a[50][50],int& n){int i,j;float c;fstream f(nume,ios::in);f>>n;for(i=1;i<=n;i++) for(j=1;j<=n;j++) if (i==j) a[i][j]=0; else a[i][j]=pinf;while(f>>i>>j>>c) a[i][j]=c;f.close();} void drum(int i,int j){int k=1,gasit=0;while ((k<=n) && !gasit){ if ((i!=k)…

Continue Readingroy floyd-grafuri orientate