temp = nodeBeingVisitedWeight+1;
for(int i=0;i<tmp.size();i++)
{
for(int y=0;y<selectedNodes.size();y++){
if(tmp.get(i).equals(selectedNodes.get(y))){
nextNode.add(new NextNode(tmp.get(i),temp));
}
}
}
//Add the current node to the visited node list
visitedNode.put(nodeBeingVisited,nodeBeingVisitedWeight);
//While the next node list is not empty
while(nextNode.isEmpty() == false)
{
//Get the current node being visited
nodeBeingVisited = nextNode.get(0).getNode();
//if the node hasn't been visited yet
if(visitedNode.containsKey(nodeBeingVisited) == false)
{
nodeBeingVisitedWeight = nextNode.get(0).getWeight();
//get its neighbors & add them at the end of the next node list
tmp = (ArrayList<DNVNode>) nodeBeingVisited.getNeighbors(true);
temp = nodeBeingVisitedWeight + 1;
for(int x=0;x<tmp.size();x++)
{
for(int y=0;y<selectedNodes.size();y++){
if(tmp.get(x).equals(selectedNodes.get(y))){
nextNode.add(new NextNode(tmp.get(x),temp));
}
}
}
//add the current node into the visited node list