Uncaught TypeError: Cannot read property 'x' of undefined (sketch: line 36)

Hello there. I am making a code for Travel Salesman Problem but i got this issue

function draw() {
background(0);
for (var i = 0; i < cities.length; i++) {
ellipse(cities[i].x , cities[i].y, 8, 8);
}

stroke(255)
strokeWeight(2)
noFill();
beginShape();
for (var i = 0; i < order.length; i++) {
var n = order [i];
vertex(cities [n].x, cities [n].y);
}
endShape();

please also show where you define and fill array order and array ( of PVector / class ) cities

generally use print to show what you have like about
i , n, cities[n]