From f2be2729c2e24ff3e36b838626d345fe293fa330 Mon Sep 17 00:00:00 2001 From: pourchot Date: Fri, 3 Feb 2023 10:59:18 +0100 Subject: [PATCH] 3 Fevrier --- Graphes/TP1:CodageDeGraphes/Exercice1.c | 165 ++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 Graphes/TP1:CodageDeGraphes/Exercice1.c diff --git a/Graphes/TP1:CodageDeGraphes/Exercice1.c b/Graphes/TP1:CodageDeGraphes/Exercice1.c new file mode 100644 index 0000000..e64dde0 --- /dev/null +++ b/Graphes/TP1:CodageDeGraphes/Exercice1.c @@ -0,0 +1,165 @@ +#include +#include +#include +#include + +struct graphe{ + int ordre; /*l'ordre du graphe*/ + int** adj; /*la matrice d'adjacence, donnée par un double tableau dynamique*/ + int oriente; /*vaut 0 si le graphe est non orienté, 1 sinon*/ +}; + +typedef struct graphe graphe; + +graphe creergraphe(int ord,int or){ + int i; + int j; + graphe NouvGraphe; + NouvGraphe.ordre=ord; + NouvGraphe.oriente=or; + NouvGraphe.adj=calloc(ord,sizeof(int*)); + for (i=0;i