DEV Community

Cover image for Dijkstra Algorithm Greedy Method
YTTMP3
YTTMP3

Posted on

1

Dijkstra Algorithm Greedy Method

Dijkstra Algorithm Greedy Method is a greedy algorithm that solves the single-source shortest path problem for a directed graph G = (V, E) with nonnegative edge weights, i.e., w (u, v) ≥ 0 for each edge (u, v) ∈ E. For the Definition and more visit HERE

Greedy Approach: Maintain a set of Explored Nodes S for which algorithm has determined d[u] = length of shortest s->u path.

Initialize S = {s}, d[s] = 0
Repeatedly Choose Unexplored node v does not belong S which minimizes
Pie(v) = min ( d[u] + le )

add v to S, and set d[v] = Pie(v).
To recover path, set pred[v] = e that achieves min.
Example for Dijkstra Algorithm Greedy Method

To read more visit https://hecodesit.com/dijkstra-algorithm-greedy-method/

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay