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

graf eulerian

Graf eulerian #include<fstream.h>#include<conio.h>struct nod{int nd;nod *adr_urm;};int a[10][10],s[10],n;nod *lista, *indice; void citire(char graf[10],int a[10][10],int& n){int i,j;fstream f(graf,ios::in);f>>n;while (f>>i>>j) a[i][j]=a[j][i]=1;f.close();} void ciclu(nod* v){int nodul;nod *nod_baza,*nod_gasit,*nod_urm;nod_urm=v->adr_urm;nod_baza=v;do{ nodul=1;while (a[nod_baza->nd][nodul]==0) nodul++;a[nod_baza->nd][nodul]=0;a[nodul][nod_baza->nd]=0;nod_gasit=new nod;nod_gasit->nd=nodul;nod_gasit->adr_urm=0;nod_baza->adr_urm=nod_gasit;nod_baza=nod_gasit;}while (nod_gasit->nd!=v->nd);nod_baza->adr_urm=nod_urm;} int adauga(){int…

Continue Readinggraf eulerian