Let G = (V,E) be an (unweighted, undirected) graph with n = |V| nodes and m = |E| edges. Let s,t ∈ V be two nodes in G, let R ⊆ E be a subset of the edges of G, and let k ≥ 1 be an integer. The problem statement is as follows: Restricted Edges Problem. Given G, R, s, t, k, determine whether there exists a path in G from s to t that uses at most k edges in R. Neighbors of any arbitrary vertex v are stored in an adjacency list. Also, it takes O(1) time to check if an edge between two nodes is regular or restricted.
Example Input: The following graph G with restricted edges labeled R, k=1
Output: No path.
Create an algorithm, then do a Proof of Correctness for said algorithm. What is the time and space complexity of the algorithm?
$S$
$1$
$R$
$3$
$R$
$2$
$R$
$4$
$5$
$+$