Hi, I use the following code to create kinght tour visualizations:
df <- read.csv("D:\\knightTours\\RothN.csv")
Mat = as.matrix(df)
var.size = n
coords <- tibble(col = rep(1:var.size, var.size),
row = rep(1:var.size, each = var.size))
coords %>%
mutate(order = Mat[var.size * col + row]) %>%
arrange(order) %>%
ggplot(aes(x = col, y = row )) +
geom_path() +
coord_equal()
Each csv file contains n * n amount of numbers: 0, 1, 2, 3, ... n * n
However when n > 99, the plot is not looking as expected, more precisly, I found out that the chaos occurs when there is any 5 digit number in the .csv file.
here is the plot for n = 99:
and here is the plot for n = 100:
in the same n = 100 plot, replacing 10000 digit with 0, while connecting 0 with 1, produces a plot correct with the numbering within the csv file, which cemented me in the belief of 5 digit number being a problem:
the issue grows only larger with bigger n, here is n = 125:
The plot looks as expected for all n <= 99, why the appearance of 5 digits number in the matrix destroys the whole plot ?