/* -*-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 <assert.h>
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]];
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));
}
}