Suppose that a map of a bus system is provided by Graph G. Each edge of this graph is colored to distinguish the bus line that this edge is associated with. Find an algorithm that returns the smallest number of times that you have to change lines to go from the top to the top. You can assume that all edges of a given line are connected. More precisely, it is possible to go from a stop on one line to another stop on this line without changing lines.
Solution provided as:
So, confused with the statement "Note that the number of steps on this path to trans-locate between stop and lines has a length of 2k." Can any one please me visualized? Understand that we can use BFS to find the shortest path in an unweighted graph. K is the number of different lines, but why is 2k the number of steps on this path? Try to build the graph, do not think that it is corrected. A clue?