#include #include #include struct vertex { int id; struct vertex *next; }; typedef struct vertex* verticepunt; // /*Structure for dfs */ struct visitaVertice { int color; // int p; // int d; // int f; // time to vertex }; //new vertex verticepunt newVertex(){ verticepunt v; v=(verticepunt)malloc(sizeof(struct vertex)); v->next=NULL; return v; } /*INIT*/ void init(verticepunt list[],int n){ int i; for(i=0;iid=i; p=list[j]; if(p==NULL){ list[j]=nuovo; // temp=temp+1; } else { //caso in cui sia diverso da 1 while(p->next!=NULL) p->next=nuovo; } } } } //return (temp) } //Random genenrator int randomGen(int end){ int fine; fine= end -1; srand((unsigned)time(0)); int generated = rand() % fine + 1; return generated; } /**DFS*/ void dfs(verticepunt list[],int n){ int i; verticepunt p; struct visitaVertice dfsdata[n]; //Struttura dati che contiene i dati dfs initdfs(dfsdata,n); //Inizializza tale lista tempo=0; for(i=0;iid; if(dfsdata[k].color==0){ dfsdata[k].p=i; } p=p->next; } dfsdata[i].color=2; //Colore nero tempo=tempo+1; dfsdata[i].f=tempo; } /*transposed OF Graph*/ verticepunt getTrasposta(verticepunt list[],int n) { verticepunt trasposta[n]; verticepunt e; verticepunt pT; /*faccio scorrere array dei vertici*/ int j; for(j=0;jid = p->id; q1 = q; p = p->next; } return(q1); } int main(int argc, char** argv) { return (EXIT_SUCCESS); }