Marson,
шифровка из центра ...
const arr = [
{ name: 'Ali', close: ['Vasil', 'Wog'] },
{ name: 'San', close: ['Vasil', 'Zena'] },
{ name: 'Vasil', close: ['San', 'Ali'] },
{ name: 'Wog', close: ['Zena', 'Ali'] },
{ name: 'Zena', close: ['Sun', 'Wog'] }
];
const setName = new Set(arr.map(({name}) => name));
let curent = 'Ali'
let list = [curent];
for (let i = 0; i < arr.length-1; i++) {
let {close} = arr.find(({name}) => name == curent);
curent = close.find( name => setName.has(name) && !list.includes(name))
if(!curent) {
[curent, ...a] = setName;
}
list.push(curent);
setName.delete(curent)
}
console.log(list)
list = list.map(n => arr.find(({name}) => name == n))
console.table(list)