I’m teaching myself how to program algorithms involving TSPs (Djikstra, Kruskal) and I’m looking for some start up advice. I am working with C# and SQL. Ideally I’d like to be able to do this strictly in SQL however I’m not sure if that is possible (I assume the runtime would be awful after 50 vertices).
So I guess the question is, can I do this is only SQL and if so what is the best approach? If not, and I have to get C# involved what would be the best approach there?
It is only advisable to do simple calculations in SQL, like calculating sums. Sums are faster in SQL, because only sums are returned instead of all the records. Complicated algorithms like the ones you have in mind must be done in your c# code! First, the SQL language is not suited for such problems, second it is optimized for db accesses, making it very slow for other types of uses.
Read your data from your db with SQL into an appropriate data structure into your c# program. Do all the TSP related logic there and, if you want, store the result in the db, when finished.