From b7e9fd77cd09197fec2c3acf3a165afa9dd2a4cb Mon Sep 17 00:00:00 2001 From: pourchot Date: Fri, 17 Mar 2023 12:43:26 +0100 Subject: [PATCH] 17 Mars --- Graphes/FichierDef.h | 53 ++++++++++++++++++++++++++++++++++++++++++++ Graphes/testgraphe.c | 1 - 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/Graphes/FichierDef.h b/Graphes/FichierDef.h index b0f96be..71f46d3 100644 --- a/Graphes/FichierDef.h +++ b/Graphes/FichierDef.h @@ -11,6 +11,59 @@ struct graphe{ typedef struct graphe graphe; +struct file { + int data; + struct file* succ; +}; + +typedef struct file fifo; + +fifo* enqueue(fifo **fi,int v){ + fifo *nf=malloc(sizeof(fifo)); + nf->data=v; + nf->succ=*fi; + return nf; +} + +int dequeue(fifo **fi){ + fifo *lect=*fi; + if(lect->succ==NULL){ + int res=lect->data; + *fi=NULL; + return res; + } + while(lect->succ->succ!=NULL){ + lect=lect->succ; + } + int res=lect->succ->data; + fifo *temp=lect->succ; + lect->succ=NULL; + free(temp); + return res; +} +int empty(fifo *fi){ + return fi==NULL; +} + +void afficheFile(fifo *fi){ + fifo *affichage=malloc(sizeof(fifo)); + affichage=fi; + while(affichage->succ!=NULL){ + printf("%hu ",affichage->data); + affichage=affichage->succ; + }free(affichage); +} + +fifo* fileVoisins(graphe g,int v){ + fifo *res=malloc(sizeof(fifo)); + int i; + for(i=0;i #include "FichierDef.h" - int main(int argc, char const *argv[]){ graphe Graphe; int connexe;