I've tried a couple of approaches and they all ended in a dead end. The question:
Given a G=(V,E) a directed unweighted graph in which every vertex is colored red or blue. Let there be vertices s and t from V. Describe an algorithm that would find a path between s and t which would hold the least red vertices. Explain the algorithm, prove it and show its complexity.
I've thought of 2 approaches and discarded both:
- Use an adjacency list sorted by colors (blue first red last) and run a DFS - bad idea
- Set the weight of each edge from a red vertex to 2 and blues to 1 and run Dijkstra - found a counterexample
I would really be happy to get some help with the right direction. I prefer NOT to get full answers but rather hits/tips.