Implement a programs to walk through a graph using Dijkstra's algorithm. YOU MUST USE AN ABSTRACT DATA STRUCTURE which supports arbitrary numbers of edges per vertex. DO NOT use a matrix. Some of the graphs will be too large for a matrix.

For the priority queue, use an EXTENDED HEAP. We've talked about this in class a bunch of times -- you'll need to implement a normal binary heap, but will need an extra array of integers that stores the location of each vertex within the heap. When you update the distance to an element in the heap, you'll need to find the location of the vertex, and then have it "percolate up." When the vertex percolates up, you'll also need to update the locations of things in this extra array.

The input will consist of the # of vertices, the # of edges, and then a series of edges. As an example, we might have a 5 vertex graph, with 4 edges. I'll name the vertices A, B, C, D, E, for explanation, but they'll actually be numbered 0 through 4. A connects to B with a length of 10, B connects to C with length 3, A connects to D with length 5, A connects to E with length 2. The input file looks like this:

5 4
0 1 10
1 2 3
0 3 5
0 4 2

Compute the distances from vertex 0 to every other vertex. If there are less than 10 vertices, print the distance to each. If there are 10 or more vertices, print the distance to the furthest vertex (and print which vertex it is).