contestada

Consider a directed graph G, where each edge is colored either red, white, or blue. A walk in G is called a French flag walk if its sequence of edge colors is red, white, blue, red, white, blue, and so on. More formally, a walk v0tov1to. . .to vk is a French flag walk if, for every integer i, the edge vi to vi+1 is red if i mod 3 = 0, white if i mod 3 = 1, and blue if i mod 3 = 2. French flag walks are allowed to repeated vertices. Describe an algorithm to find all vertices in G that can be reached from a given vertex v through a French flag walk. [Hint: Perform a reduction to normal graph reachability.]