how do i implement depth first search into my program?

how do i implement depth first search into my program?
there are 5 cities, inbetween these cities are bridges. each bridge has a maximum weight. i want to take a truck to visit 3 of these cities. what is the maximum weight of truck i can take with me?
the focus of this program is to find the route to the 3 cities using the bridges with the largest maximum weight.

My friend said i should use depth first search. i have no idea how to use it in my program. could someone tell me how?
Topic archived. No new replies allowed.