If you do not find what you're looking for, you can use more accurate words.
ما يلي هو تطبيق الخوارزمية بلغة java, وهذا التطبيق هو ليس الأفضل بالضرورة ولكنه نموذج لطريقة التطبيق :
class Dijkstra { double[] dist = new double[G.V()]; Edge[] pred = new Edge[G.V()]; public Dijkstra(WeightedDigraph G, int s) { boolean[] marked = new boolean[G.V()]; for (int v = 0; v <G.V(); v++) dist[v] = Double.POSITIVE_INFINITY; MinPQplus<Double, Integer> pq; pq = new MinPQplus<Double, Integer>(); \Priority Queue dist[s] = 0.0; pq.put(dist[s], s); while (!pq.isEmpty()) { int v = pq.delMin(); if (marked[v]) continue; marked(v) = true; for (Edge e : G.adj(v)) { int w = e.to(); if (dist[w]> dist[v] + e.weight()) { dist[w] = dist[v] + e.weight(); pred[w] = e; pq.insert(dist[w], w); } } } } }