chap graphs /dijkstra' shortest-pathspriority queue version static void dijkstra(graph gint sint[dint /the current vertex dijkelem[ new dijkelem[ ()]/heap for edges [ new dijkelem( )/initial vertex minheap new minheap( ())for (int = < () ++/initialize distance [iinteger max valued[ for (int = < () ++/for each vertex do ( removemin()vertex()/get position while ( getmark( =visited) setmark(vvisited)if ( [ =integer max valuereturn/unreachable for (int first( ) () next(vw)if ( [ ( [vg weight(vw))/update [wd[vg weight(vw) insert(new dijkelem(wd[ ]))figure an implementation for dijkstra' algorithm using priority queue initial process process process process process figure listing for the progress of dijkstra' algorithm operating on the graph of figure the start vertex is in the subsetand ( keeps the vertices connected applications where solution to this problem is useful include soldering the shortest set of wires needed to connect set of terminals on circuit boardand connecting set of cities by telephone lines in such way as to require the least amount of cable the mst contains no cycles if proposed set of edges did have cyclea cheaper mst could be had by removing any one of the edges in the cycle thusthe mst is free tree with | edges the name "minimum-cost spanning treecomes from the fact that the required set of edges forms treeit spans the vertices