Ok, I need help getting started. I know the rules and such so I'm not asking for anyone to tell me answers or anything like that. I can do Dijkstra's algorithm no problem on paper with a graph, but when it comes to the java implementation I have a harder time.

So, my problem is I need to write a program that computes the shortest path from a source city to a destination city. I am given a file with lots of lines that look like [Source city], [Destination city], [Travel time], [travel cost]
so it looks something like HOU, NYC, 345, 421
travel time is in minutes

A user can give any source and any destination based on either time or cost and my algorithm should output the smallest path from that source to the destination.

It wants me to store the information in a graph data structure...

I think what I want to do is make an array of nodes where the node class holds the above information, a key where the key is either the distance from the source or the price from the source, a next node pointer, and previous node pointer. I think this will allow me to build a linked list of nodes.

Any ideas/suggestions on how this will work out getting me started? Am I on the right track or is there an easier way to do this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.