Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Implementation of Recursive Depth First Search

Xee2012Xee2012 Posts: 2Member
I need to solve Travelling Salesman problem using Recursive Depth First Search.I started with reading the text file in 2D array for distances and 1 D array for the cities.Now I need follow the following pseudo code.What I am really confused with is what form of data structure is accepted by the DFS()below.Do I need to get a tree notation first like some link list.

void Depth_first_search(tour_t tour)
{
city_t city;

if (City_count(tour) == n)
{
if (Best_tour(tour))
Update_best_tour(tour);
}
else
{
for each neighboring city
if (Feasible(tour, city))
{
Add_city(tour, city);
Depth_first_search(tour);
Remove_last_city(tour);
}
}
}
Desperately need some relevant help.Thank You
Sign In or Register to comment.