X-Git-Url: https://git.distorted.org.uk/~mdw/rocl/blobdiff_plain/b758c3433840e6a51f285455ccdee07dcebf52b6..4041fdd8af852bf6fb4db0aa6ddd2c8c2f640574:/graph.c diff --git a/graph.c b/graph.c index 2ec27f8..9dc3942 100644 --- a/graph.c +++ b/graph.c @@ -1,40 +1,27 @@ /* -*-c-*- * - * $Id: graph.c,v 1.2 2003/03/08 00:40:32 mdw Exp $ - * * Graph theory stuff * * (c) 2003 Mark Wooding */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: graph.c,v $ - * Revision 1.2 2003/03/08 00:40:32 mdw - * Fix unsigned crapness in travelling-salesman solver. - * - * Revision 1.1 2003/03/07 00:45:13 mdw - * Graph theory functions. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -375,7 +362,7 @@ static int cmd_tsp(ClientData cd, Tcl_Interp *ti, if (nn <= 2) { memcpy(r_best, r, nn * sizeof(*r)); - if (n == 1) + if (nn == 1) c_best = a[r[0] * n + r[0]]; else c_best = a[r[0] * n + r[1]]; @@ -547,7 +534,7 @@ static int cmd_tsp(ClientData cd, Tcl_Interp *ti, t = r[i]; r[i] = r[j]; r[j] = t; if (c_curr < c_best) { c_best = c_curr; -/* printf("*** new best = %lu\n", c_best); */ +/* printf("*** new best = %lu\n", c_best); */ memcpy(r_best, r, nn * sizeof(*r)); } }