testing things

thinking of how to display the ants moving and optimise by moving at
least one on each path
This commit is contained in:
Tanguy MAZE
2019-04-05 17:43:17 +02:00
parent 0a9d7b816d
commit c36f501b08
5 changed files with 144 additions and 93 deletions

View File

@@ -6,7 +6,7 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/28 16:21:19 by tmaze #+# #+# */
/* Updated: 2019/04/03 17:18:35 by tmaze ### ########.fr */
/* Updated: 2019/04/05 15:13:53 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
@@ -78,8 +78,6 @@ t_ind **resolve_path(t_lmdata *data, int s_ind, int e_ind
return (clean_ret(ret));
j = reset_weights(data, s_ind, j);
}
if (j != -1 && lst_indadd(&(ret[i]), j) == NULL)
return (clean_ret(ret));
i++;
}
}
@@ -92,12 +90,16 @@ t_ind **edmunds_karp(t_lmdata *data, int start_ind, int end_ind)
int nb_path;
nb_path = 0;
bfs(data, tab, start_ind, end_ind);
while (tab[end_ind].parent != -1)
if (data && data->adj)
{
nb_path++;
update_weights(data, tab, end_ind);
bfs(data, tab, start_ind, end_ind);
while (tab[end_ind].parent != -1)
{
nb_path++;
update_weights(data, tab, end_ind);
bfs(data, tab, start_ind, end_ind);
}
return (resolve_path(data, start_ind, end_ind, nb_path));
}
return (resolve_path(data, start_ind, end_ind, nb_path));
return (NULL);
}