private Node[] getNeighbors(int index){
		boolean top = false;
		boolean bottom = false;
		boolean left = false;
		boolean right = false;
		int count = 0;
		if(index >= grid.getDim()){
			top = true;
			count++;
		}
		if(index % grid.getDim() < grid.getDim()-1){
			right = true;
			count++;
		}
		if(index + grid.getDim() < nodeMap.length){
			bottom = true;
			count++;
		}
		if(index % grid.getDim() > 0){
			left = true;
			count++;
		}
		Node[] neighbors = new Node[count];
		count = 0;
		if(top) neighbors[count++] = nodeMap[index-grid.getDim()];
		if(right) neighbors[count++] = nodeMap[index+1];
		if(bottom) neighbors[count++] = nodeMap[index+grid.getDim()];
		if(left) neighbors[count++] = nodeMap[index-1];
		return neighbors;
	}