I have a college assignment.
I already have it working with a depth first search on the data structure [it's not a tree since there are loops]
Basically, the professor just wants the program to find A path and the price of said path.
I have that basically worked out. But I want to bring it a step further and offer "Lowest total price" option
and "lowest amount of crossover flights" and perhaps if I'm feeling up to it "lowest total price" although that would use
the same algorithm for the lowest total price.
Basically, I was thinking about using iterative deepening depth first search but I heard that's only usable on data trees.
What algorithm would I need to implement.?
Basically what I have now:
City class
--String of name
--Hashmap of cities that it connects to, price per connection
--getname()
--getDestMap()
--addDest()
--depthFirstSearch(City start, goalfunction isGoal, stack<City> result)
Goalfunction is an interface
Main class
--hashmap of cities and theyre name
scanner
to add to the tree
CODE REMOVED Since it's not needed anymore