public ArrayList<Node> runAstar(AGraph g) {
		g.run = true;
		if ((g.start != null) && (g.dest != null)) {
			//Makes sure the user has properly set up the program
			if (g.start.equals(g.dest)) {
				//if user inputs a start node and a destinaiton node that are the same
				ArrayList<Node> output = new ArrayList<Node>();
				output.add(g.start);
				visits = 1;
				pathCost = 0;
				return output;
			}
			
			evaluated = new ArrayList<Node>();
			toEvaluate = new PriorityQueue<Node>();
			cameFrom = new HashMap<Node, Node>();
			
			//initializes the algorithm, setting the starting node's g to 0
			g.start.g = 0;
			g.start.setH(g.dest);
			toEvaluate.add(g.start);
			visits = 0;
			pathCost = 0;
			while (!toEvaluate.isEmpty()) {
				// removes the current node from the priority queue
				Node current = toEvaluate.remove();
				visits ++;
				if (current.equals(g.dest)) {
					pathCost = current.g;
					/*checks to see if the destination has been found, and initializes the
					path reconstruction method */
					path = new Stack<Node>();
					reconstruct(current);
					ArrayList<Node> output = new ArrayList<Node>();
					while (!path.isEmpty()) {
						//the stack contains the nodes inputed in reverse order, so this will
						// add them into the arrayList in traversal order.
						if (!output.contains(path.peek())) {
							output.add(path.pop());
						} else {
							path.pop();
						}
					}
					return output;
				}
				//adds current node to the evaluated set and marks the node as visited.
				evaluated.add(current);
				current.visited = true;
				//System.out.println(current.x + "," + current.y);
				checkAndAdd(current, g.dest);
			}
			return null;
		}
		return null;
	}