I am writing a program to calculate the shortest path between two nodes. In my program I have one custom class called NodeList, which contains an ArrayList of strings (representing nodes) along with a distance. I am using Dijkstra's algorithm which involves opening up the shortest edge from each node. So, I use this loop to tabulate the possible routes from a given point:
for ( NodeList ed : edges )
{
if (ed.nodeList.get(0).equals(node1))
{
routes.add(ed);
}
}
This works fine, and appears to load the correct values into the variables (according to the debugger). However, when I try and set a variable to the distance of one of the nodes, I get a message "cannot find symbol variable distance". Here is the code that causes the problem:
int minDistance = routes.get(0).distance;
Is this abnormal or is there something obvious I'm missing?