input = Graph g, String start, String goal initialize pq as PriorityQueue, tree as List, startVertex as Vertex, goalVertex as Vertex startVertex = g.getVertex(start) goalVertex = g.getVertex(goal) call pq.push(startVertex, 0) while tree.contains(goalVertex) = false initialize v as Vertex, weight as Integer v = pq.pop(weight) if v.isVisited != true then v.isVisited = true v.weight = weight call tree.add(v) unvisitedNeighbors = unvisitedNeighbors(v) forEach n in unvisitedNeighbors call pq.push(n, v.weight + g.d(v, n)) next endIf endWhile say(goalVertex.weight) finish function unvisitedNeighbors(Vertex v) initialize neighbors as List forEach n in v.neighbors if n.isVisited != true then call neighbors.add(n) endIf next return neighbors endFunction