tsp_display <- function ( prefix, n, x ) #*****************************************************************************80 # ## tsp_display() plots cities and a tour connecting them. # # Discussion: # # The code now automatically closes the loop by returning to the first city. # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 27 July 2026 # # Author: # # John Burkardt # # Input: # # string prefix: a string that defines the name of the problem. # # integer n: the number of cities. # # real x(n,2): the x and y coordinates of the cities. # { filename = paste0 ( prefix, ".png" ) png ( filename ) plot ( c ( x[,1], x[1,1] ), c ( x[,2], x[1,2] ), xlab = "<--- X --->", ylab = "<--- Y --->", main = prefix, col = "blue", type = 'l' ) grid ( nx = 5, ny = 5, col = "black" ) cat ( ' Graphics saved as "', filename, '"\n' ) return ( ) }