Question: Consider a directed graph G , where each edge is colored either red, white, or blue. A walk in G is called a French flag

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 v_(0),v_(1),...,v_(k) is a French flag walk if, for every integer i, the edge (v_(i),v_(i+1)) is red (resp., white, blue) if i mod 3=0(resp.,1,2). Design a linear-time algorithm to find all nodes in G that can be reached from a given node s through a French flag walk.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!