From db9305bea1f42fb0a2fbca99c2f9c866291ae40d Mon Sep 17 00:00:00 2001 From: "James D. Mitchell" Date: Wed, 29 Jan 2020 11:19:23 +0000 Subject: [PATCH] Fix bug in digraph homom. finder --- src/homos-graphs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/homos-graphs.c b/src/homos-graphs.c index 11624e301..b3662fbca 100644 --- a/src/homos-graphs.c +++ b/src/homos-graphs.c @@ -135,7 +135,7 @@ static void init_bliss_graph_from_digraph(Digraph const* const digraph, uint16_t out_color = 0; uint16_t const n = digraph->nr_vertices; for (uint16_t i = 0; i < n; i++) { - out_color = (colors[i] > out_color ? colors[i] + 1 : out_color); + out_color = (colors[i] >= out_color ? colors[i] + 1 : out_color); bliss_digraphs_change_color(bg, i, colors[i]); } uint16_t const in_color = out_color + 1; @@ -163,7 +163,7 @@ static BlissGraph* new_bliss_graph_from_digraph(Digraph const* const digraph, uint16_t const n = digraph->nr_vertices; bg = bliss_digraphs_new(0); for (uint16_t i = 0; i < n; i++) { - out_color = (colors[i] > out_color ? colors[i] + 1 : out_color); + out_color = (colors[i] >= out_color ? colors[i] + 1 : out_color); bliss_digraphs_add_vertex(bg, colors[i]); } uint16_t const in_color = out_color + 1; @@ -233,6 +233,7 @@ static void bliss_hook(void* user_param_arg, // perm_coll! Perm p = new_perm(PERM_DEGREE); unsigned int const min = (N < PERM_DEGREE ? N : PERM_DEGREE); for (uint16_t i = 0; i < min; i++) { + DIGRAPHS_ASSERT(aut[i] < min); p[i] = aut[i]; } for (uint16_t i = min; i < PERM_DEGREE; i++) {