diff --git a/relations.c b/relations.c index 223ed919b7486e799874b99749bbcd6370bb1425..868125e2d3bcba4269548b056f5a87af4e0de4c0 100644 --- a/relations.c +++ b/relations.c @@ -118,15 +118,15 @@ void detruire(listeg lst){ } } listeg rech(listeg lst, void *x, int(*comp)(void *, void *)){ + listeg resultat = listegnouv(); listeg copy = lst; while(copy != NULL){ if( comp(x, copy->val) ){ - return lst; - }else{ - copy = copy->suiv; + resultat = adjqueue(resultat, copy->val); } + copy = copy->suiv; } - return NULL; + return resultat; } //////////////////////////////////////// @@ -292,7 +292,8 @@ void adjRelation(Relations g, char *nom1, char *nom2, rtype id){ // 4.1 listes de relations listeg en_relation(Relations g, char *x){ - return NULL; + listeg liste = g->listDeRelations; + liste = rech(liste, x, compSommet); } listeg chemin2(Relations g, char *x, char *y){ return NULL; @@ -307,8 +308,9 @@ bool ont_lien_parente(Relations g, char *x, char *y){ // PRE CONDITION: les sommets correspondants � x et y sont de type PERSONNE // PRE CONDITION: strcmp(x,y)!=0 bool se_connaissent(Relations g, char *x, char *y){ - return false; + return 0; } + // PRE CONDITION: les sommets correspondants � x et y sont de type PERSONNE // PRE CONDITION: strcmp(x,y)!=0 bool se_connaissent_proba(Relations g, char *x, char *y){