Consider the graph in Figure 5. The following figures illustrate how Dijkstra’s algorithm works in constructing a shortest-paths tree rooted at vertex a.
Initially, all δ[•] values are ∞, except δ[a] = 0. Set S contains all vertices in the graph. Vertex
a, shown as a shaded vertex in Figure 6, has the minimum δ value and is chosen as vertex u in the
while loop. We remove a from S. Then edges (a, b) and (a, g), shown as dotted lines, are relaxed.
Now shaded vertex b in Figure 7 has the minimum δ value among all vertices in S and is chosen as vertex u in the while loop. We remove b from S. Dark edge (a, b) is added to the shortest-paths tree under construction, and dotted edges (b, c) and (b, d) are relaxed.
Both vertices d and g in Figure 8 have the minimum δ values among all vertices in S. Let us choose g as vertex u in the while loop. We remove g from S. Dark edge (a, g) is added to the shortest-paths tree, and dotted edges (g, e) and (g, h) are relaxed.
Since vertex d in Figure 9 has the minimum δ value among all vertices in S, it is chosen as
Consider the graph in Figure 5. The following figures illustrate how Dijkstra’s algorithm works in constructing a shortest-paths tree rooted at vertex a.Initially, all δ[•] values are ∞, except δ[a] = 0. Set S contains all vertices in the graph. Vertexa, shown as a shaded vertex in Figure 6, has the minimum δ value and is chosen as vertex u in thewhile loop. We remove a from S. Then edges (a, b) and (a, g), shown as dotted lines, are relaxed.Now shaded vertex b in Figure 7 has the minimum δ value among all vertices in S and is chosen as vertex u in the while loop. We remove b from S. Dark edge (a, b) is added to the shortest-paths tree under construction, and dotted edges (b, c) and (b, d) are relaxed.Both vertices d and g in Figure 8 have the minimum δ values among all vertices in S. Let us choose g as vertex u in the while loop. We remove g from S. Dark edge (a, g) is added to the shortest-paths tree, and dotted edges (g, e) and (g, h) are relaxed.Since vertex d in Figure 9 has the minimum δ value among all vertices in S, it is chosen as
การแปล กรุณารอสักครู่..

พิจารณากราฟในรูปที่ 5 รูปภาพต่อไปนี้แสดงวิธีการทำงานขั้นตอนวิธีของไดค์สตราสร้างเส้นทางสั้นที่สุด ต้นไม้รากที่จุดยอด A .
ตอนแรก ค่าδ [ A4 ] ทั้งหมด∞ ยกเว้นδ [ ] = 0 s ชุดประกอบด้วยจุดในกราฟ จุดยอด : ดังแสดงในรูปที่ 6 จุดยอดสีเทา มีมูลค่าδน้อยที่สุด และถูกเลือกเป็นจุดยอด u ใน
ในขณะที่วง เราเอาจาก sแล้วขอบ ( a , b ) ( , g ) แสดงเป็น จุด เส้น ผ่อนคลาย จุดยอด B
ตอนนี้สีเทาในรูปที่ 7 มีขั้นต่ำδค่าของจุดทั้งหมดในและถูกเลือกเป็นจุดยอด u ในในขณะที่วง เราเอา B จากขอบมืด S ( A , B ) จะถูกเพิ่มในเส้นทางสั้นที่สุดต้นไม้ภายใต้การก่อสร้าง และเส้นขอบ ( B , C ) , ( B , D )
ผ่อนคลายทั้งจุด D และ G ในรูปที่ 8 มีδค่าต่ำสุดของจุดทั้งหมดในเกาหลีใต้ ให้เราเลือกเป็นจุดยอด u G ในในขณะที่วง เราเอา G จากขอบมืด S ( G ) จะถูกเพิ่มในเส้นทางสั้นที่สุด ต้นไม้ และเส้นขอบ ( G , e ) และ ( F , h ) จะผ่อนคลาย .
ตั้งแต่จุดยอด D ในรูปที่ 9 มีขั้นต่ำδค่าของจุดใน คือเลือกเป็น
การแปล กรุณารอสักครู่..
