diff options
author | Alex Auvolat--bernstein <auvolat@clipper.ens.fr> | 2013-12-04 17:57:00 +0100 |
---|---|---|
committer | Alex Auvolat--bernstein <auvolat@clipper.ens.fr> | 2013-12-04 17:57:00 +0100 |
commit | f7022495daa31b714a73d6bdf6640db7494f1f4c (patch) | |
tree | b45ab0ebeb032ce663edb6b281dafb30e52e8636 | |
parent | 240653afef64b5cce9cd6ed032c2e32445149f15 (diff) | |
download | AlgoProg-Projet-f7022495daa31b714a73d6bdf6640db7494f1f4c.tar.gz AlgoProg-Projet-f7022495daa31b714a73d6bdf6640db7494f1f4c.zip |
Added optimization to algo C.
-rw-r--r-- | algos.c | 4 | ||||
-rw-r--r-- | graph.c | 1 |
2 files changed, 3 insertions, 2 deletions
@@ -53,8 +53,10 @@ void max_clique_b(const graph g, set k, set c, set a, set *mc) { // Il est donc de la responsabilité de l'appellant de vérifier qu'à // chaque appel les sets sont utilisables et cohérents void max_clique_c(const graph g, set k, set c, set a, set *mc) { + if (set_size(k) + set_size(c) <= set_size(*mc)) return; + if (is_set_empty(c)) { - if (set_size(k) > set_size(*mc)) { + if (set_size(k) > set_size(*mc)) { // useless condition delete_set(*mc); *mc = copy_set(k); printf("Found new max clique: "); dump_set(*mc); fflush(stdout); @@ -65,7 +65,6 @@ graph load_graph_dimacs(FILE *stream) { } fscanf(stream, " %d %d\n", &a, &b); - fprintf(stderr, "Edge: (%d, %d)\n", a, b); a--; b--; set_add_ip(b, k->neighbour[a]); set_add_ip(a, k->neighbour[b]); |