Problem 4.
Your task is to write an algorithm that given a directed graph G = (V, E), start vertex s, target vertex t, finds a shortest path from s to t that alternates between edges with even weight and edges with odd weight, starting with an edge with even weight.
For instance, the shortest path in the graph from A to D is A, E, D with weight 2 + 4 = 6. However, this path does not alternate edges with even and odd weight. A shortest path in the graph from A to D that alternates edges with even weight and odd weight is ABCD which has weight 4 + 1 + 2 = 7.