Skip to content
Extraits de code Groupes Projets
Valider 773de9c6 rédigé par Samuh's avatar Samuh
Parcourir les fichiers

BFS non testé

parent c1733cc8
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -13,7 +13,7 @@ clean: ...@@ -13,7 +13,7 @@ clean:
$(EXECUTABLE): main.o $(EXECUTABLE): main.o file.o
$(CC) $(OPTIONS) -o $@ $^ $(MATH) -g $(CC) $(OPTIONS) -o $@ $^ $(MATH) -g
......
#include "adjarray.c" #include "adjarray.c"
#include "file.h"
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// BFS int BFS(adjlist* g, unsigned long s){
file_t F = new_file(42);
int* marked = (int *)malloc((g->n)*sizeof(int));
for (unsigned long i = 0; i < g->n; i++)
{
marked[i] = 0;
}
enfile(F,s);
marked[s] = 1;
while (!is_empty(F))
{
unsigned long tmp = defile(F);
for (unsigned long i = g->cd[tmp]; i < g->cd[tmp+1]; i++)
{
if (marked[g->adj[i]] == 0)
{
enfile(F,g->adj[i]);
marked[g->adj[i]] = 1;
}
}
}
return 0;
}
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter