Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Lightest path from vertex to any other vertex

I got a question that I'm having a hard time with :

Given A directed graph G=(V,E) with weight function w:E->R and a source vertex s. Find an algorithm that finds the lightest path from s to every v⋹V (since it's a directed graph vertex s doesn't have to have a path to each vertex in G) in a linear time of O(|V|+|E|) and explain why this algorithm works.

It will be great if someone will be able to help me with this question cause I can't find the solution myself. Thank you!!

Comments