parent
006e2ca09e
commit
394ec0283e
Binary file not shown.
@ -0,0 +1,12 @@
|
|||||||
|
digraph family
|
||||||
|
{
|
||||||
|
6[label="S6"]
|
||||||
|
8[label="S8"]
|
||||||
|
9[label="S9"]
|
||||||
|
15[label="S15"]
|
||||||
|
23[label="S23"]
|
||||||
|
6->15
|
||||||
|
9->8
|
||||||
|
9->15
|
||||||
|
23->15
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,31 +1,29 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "liste.h"
|
||||||
|
|
||||||
typedef struct maillong
|
typedef struct maillonG
|
||||||
{
|
|
||||||
struct maillong *suiv;
|
|
||||||
int s;
|
|
||||||
Liste succ;
|
|
||||||
} Maillong, *Graphe;
|
|
||||||
|
|
||||||
typedef struct maillonl
|
|
||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
struct maillonl *suiv;
|
struct maillonG *suiv;
|
||||||
} Maillonl, *Liste;
|
Liste l;
|
||||||
|
} MaillonG, *Graphe;
|
||||||
|
|
||||||
Graphe adjs(Graphe g, int s);
|
Graphe graphNouv();
|
||||||
Graphe graphNouv(void);
|
Graphe adjst(Graphe g, int x);
|
||||||
Graphe adjt(Graphe g, int x);
|
Graphe adjs(Graphe g, int x);
|
||||||
bool vide(Graphe g);
|
|
||||||
bool exist(Graphe g, int x);
|
|
||||||
Graphe adja(Graphe g, int x, int y);
|
Graphe adja(Graphe g, int x, int y);
|
||||||
Graphe supa(Graphe g, int x, int y);
|
Graphe sups1(Graphe g, int x);
|
||||||
Graphe sups(Graphe g, int x, int y);
|
|
||||||
Graphe sups(Graphe g, int x);
|
Graphe sups(Graphe g, int x);
|
||||||
|
Graphe supa(Graphe g, int x, int y);
|
||||||
|
bool exs(Graphe g, int s);
|
||||||
|
bool exa(Graphe g, int x, int y);
|
||||||
int de(Graphe g, int x);
|
int de(Graphe g, int x);
|
||||||
int di(Graphe g, int x);
|
int di(Graphe g, int x);
|
||||||
Graphe supst(Graphe g);
|
Liste esg(Graphe g/*, int x*/);
|
||||||
void affichage(Graphe g);
|
bool videGraphe(Graphe g);
|
||||||
|
Liste esuc(Graphe g, int x);
|
||||||
|
Liste parcoursProfondeur(Graphe g, Liste e, Liste l);
|
||||||
|
void afficherGraphe(Graphe g);
|
||||||
|
@ -0,0 +1,79 @@
|
|||||||
|
#include "graphe.h"
|
||||||
|
|
||||||
|
void testList()
|
||||||
|
{
|
||||||
|
Liste l = listenouv();
|
||||||
|
|
||||||
|
l = insList(l, 3);
|
||||||
|
l = insList(l, 5);
|
||||||
|
l = insList(l, 1);
|
||||||
|
l = insList(l, 9);
|
||||||
|
l = insList(l, 20);
|
||||||
|
l = insList(l, 7);
|
||||||
|
afficherList(l);
|
||||||
|
l = supList(l, 1);
|
||||||
|
l = supList(l, 4);
|
||||||
|
l = supList(l, 9);
|
||||||
|
afficherList(l);
|
||||||
|
printf("Valeur en tete %d => 3\n", tList(l));
|
||||||
|
if(rechList(l, 1))
|
||||||
|
printf("Rech marche pas\n");
|
||||||
|
else
|
||||||
|
printf("Rech marche\n");
|
||||||
|
if(rechList(l, 20))
|
||||||
|
printf("Rech marche\n");
|
||||||
|
else
|
||||||
|
printf("Rech marche pas\n");
|
||||||
|
printf("lgList %d => 4\n", lgList(l));
|
||||||
|
}
|
||||||
|
|
||||||
|
void testGraphe()
|
||||||
|
{
|
||||||
|
Graphe g = graphNouv();
|
||||||
|
|
||||||
|
g = adjs(g, 3);
|
||||||
|
g = adjs(g, 6);
|
||||||
|
// g = adjs(g, 3); marche pas (normal)
|
||||||
|
g = adjs(g, 9);
|
||||||
|
g = adjs(g, 8);
|
||||||
|
g = adjs(g, 15);
|
||||||
|
g = adjs(g, 23);
|
||||||
|
if(exs(g, 3))
|
||||||
|
printf("exs marche\n");
|
||||||
|
else
|
||||||
|
printf("exs marche pas \n");
|
||||||
|
if(exs(g, 415))
|
||||||
|
printf("exs marche pas\n");
|
||||||
|
else
|
||||||
|
printf("exs marche\n");
|
||||||
|
g = adja(g, 3, 6);
|
||||||
|
g = adja(g, 6, 15);
|
||||||
|
g = adja(g, 9, 8);
|
||||||
|
g = adja(g, 9, 6);
|
||||||
|
g = adja(g, 9, 15);
|
||||||
|
g = adja(g, 23, 15);
|
||||||
|
// Test existe
|
||||||
|
// if(exa(g, 3, 5))
|
||||||
|
// printf("exa marche pas\n");
|
||||||
|
// else
|
||||||
|
// printf("exa marche\n");
|
||||||
|
// if(exa(g, 3, 6))
|
||||||
|
// printf("exa marche\n");
|
||||||
|
// else
|
||||||
|
// printf("exa marche pas\n");
|
||||||
|
afficherGraphe(g);
|
||||||
|
g = supa(g, 9, 6);
|
||||||
|
afficherGraphe(g);
|
||||||
|
// g = sups(g, 15); fonctionne pas (normal)
|
||||||
|
g = supa(g, 3, 6);
|
||||||
|
g = sups(g, 3);
|
||||||
|
afficherGraphe(g);
|
||||||
|
afficherList(esg(g));
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
//testList();
|
||||||
|
testGraphe();
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in new issue