Java Object instantiation question

Apr 23, 2011
Reaction score

I'm currently working on programming Dijkstra's shortest path algorithm. For the program, I read a series of vertexes and edge weights from a text file, and then return the shortest path to each vertex. I have a solid understanding of how the algorithm works, but I've run into a technical problem. I am looking to convert the string that I parse from the text file, (e.g. "v1") into a vertex object with the name v1.
I attempted to code:

vertex vertexList[0] = new vertex --- where vertexList[] is an array of strings with the names of the vertexes that I parse from the text file.

Any assistance would be greatly appreciated!


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question