Let $G=(V,E)$ a directed graph s.t $|V|=n$. Let $w:E \to \mathbb{R}$ a weight function.
Describe an algorithm which finds the minimal-weighted walk of length $\leq n$ from $s \in V$ to all other nodes.
The algorithm must return the walks and not only their respective weights.
So I have an idea, but I'm really not sure if it works. In addition, something about the runtime isn't adding up, but I can't tell what I'm missing (I'll explain after the algorithim).
Algorithim:
Find $G^{*}$ (SCC graph) using DFS
Run SSSP in DAG algorithm from the SCC that contains $s$ on $G^{*}$
$\forall v \in V$:
3.0. Exists some $C_i$ s.t $v \in C_i$
3.1. If $v \in C_i$ such that $\nexists P=s \Rightarrow C_i$ (There doesn't exist a path from $s$ to any node in $C_i$) return None
3.2. Else if, $C_i$ contains a negative cycle, take a maximal number of walks around without surpassing $n$ steps.
3.3. Else, $C_i$ has no negative cycles. Delete all nodes entering $C_i$'s representative in $G^{*}$ and run BFS. Use $G_{\pi}$ to construct the walks from $s$ to all $v \in C_i$.
So my runtime problem is that it seems to that I can do better than Bellman-Ford by using BFS on the SCC graph since building $G^{*}$ is $O(|V|+|E|)$ and BFS is linear as well.
In addition, the fact that I can't make assumptions about the weight function and not knowing about negative cycles is really throwing me off here.
Thanks in advance for help and review.