Python

C

Java

Python result:

C result:

Java result:

Dijkstra's Algorithm starting from vertex D:

D->A, Distance: 4

D->E->C->B, Distance: 8

D->E->C, Distance: 6

D, Distance: 0

D->E, Distance: 2

D->E->C->B->F, Distance: 10

D->E->G, Distance: 7

D->A, Distance: 4

D->E->C->B, Distance: 8

D->E->C, Distance: 6

D, Distance: 0

D->E, Distance: 2

D->E->C->B->F, Distance: 10

D->E->G, Distance: 7

Dijkstra's Algorithm starting from vertex D:

D->A, Distance: 4

D->E->C->B, Distance: 8

D->E->C, Distance: 6

D, Distance: 0

D->E, Distance: 2

D->E->C->B->F, Distance: 10

D->E->G, Distance: 7

D->A, Distance: 4

D->E->C->B, Distance: 8

D->E->C, Distance: 6

D, Distance: 0

D->E, Distance: 2

D->E->C->B->F, Distance: 10

D->E->G, Distance: 7

Dijkstra's Algorithm starting from vertex D:

D->A, Distance: 4

D->E->C->B, Distance: 8

D->E->C, Distance: 6

D, Distance: 0

D->E, Distance: 2

D->E->C->B->F, Distance: 10

D->E->G, Distance: 7

D->A, Distance: 4

D->E->C->B, Distance: 8

D->E->C, Distance: 6

D, Distance: 0

D->E, Distance: 2

D->E->C->B->F, Distance: 10

D->E->G, Distance: 7