Now your problem can be solved by using Dijkstra's algorithm.
Does this help with your homework?
In reply to Re: List Connection by JavaFan in thread List Connection by artist