The initial population is completely 'random'. We initially start at node 1, and create a random permutation of the remaining nodes. Since the travelling salesman must return to his starting node, we also append it to the end of the solution. This happens over and over until the population is full, as specified.
Every genetic algorithm has a function that kind of says how good something is. The function in this algorithm goes through each node of the solution and calculates the distance to the next node. This sum of distances is what is used for the fitness of that particular solution. The solutions with the least distance are the ones that are most likely to be selected as a parent during the selection phase.
A larger population gives more diversity, but it takes more time to find parents and create further populations. Depending on the size of your search space, the optimal solution may be in your initial population, which destroys the point of a genetic algorithm, and stops you visualising its progress.
Usually the mutation rate is low. We need a mutation rate, just in case we miss a certain permutation within the initial population, so by mutation we have the chance to pick it out. Mutation can also get in the way of an optimal solution, such as when something is mutating often, and the optimal solutions are lost because of it. Generally, the mutation rate should be less than 10% or 0.1.
The genes of this algorithm are basically the nodes to be visited. It is the sequence that is important in this case. Unlike genetic phrase where not all genes were present in a solution, in the case of this algorithm, all genes are present, and it is only the permutation of them that matters.
In the case of this particular algorithm, after we have selected two parents, we begin the cross-over phase. This is where we pass the two parents in to a method, and the method will exchange the nodes, or 'genes', between them, to create a potentially better solution. The cross-over selects a random segment of the first parent, and then iterates over the second parent, adding the remaining nodes. We do this because we can only visit nodes once, and this solution prevents nodes appearing twice - other than the start node, as we need to return to it.