I am having a hard time getting started with this program. It can be written in any language (but I prefer java or maybe C).

I have been given a graphs in the form of an adjacency list in a text file. My goal is simply to print the distance of the single source shortest path in the graph (that is, starting at node 0 and visiting every node with a minimum weight, and then print the weight). Some of the lists are huge (over 100,000 nodes) but here is the format of the list:

n=1000 m=8544

0
25 244
108 275
140 273

1
24 187
43 182

This is just the first few lines of the file, but the format is:

n= number of nodes
m= number of edges

then there is a blank line separating each node. On the next line, the node is named (only node 0 and 1 are shown in this example). After the name of the node, each line shows two numbers. The first number is the neighbor nodes name, and the second number is the weight of the edge. So in the example I gave, there are 1000 nodes with 8544 edges. The node named "0" is neighbors with "25" and the weight is 244. Node "0" is also neighbors with "108" and its weight is 275. Node "1" is neighbors with "24" with weight 187, etc...

THIS GRAPH IS UNDIRECTED, BUT THE EDGES ARE ONLY MENTIONED ONCE IN THE LIST! (you can obviously travel from 0 to 25, but you can also travel from 25 to 0 even though 0 is NOT listed in 25's adjacency list, it is just to be assumed that all edges are traversable in both directions).

I know how to read in files and parse them, and I know how the algorithm works (if I had a picture of the graph in front of me). I am just having a hard time connecting this adjacency list to the algorithm to the actual code. How would you do this and what data structures would you use? (I am not asking for code, unless you really want to write some. I just need something to spark my brain).