input = DirectedGraph g, String start, String goal initialize pq as PriorityQueue, tree as List, startVertex as Vertex, goalVertex as Vertex call g.displayProperties.add("isVisited") startVertex = g.getVertex(start) goalVertex = g.getVertex(goal) call pq.push(startVertex, 0) ask: while tree.contains(goalVertex) = false initialize v as Vertex, weight as Integer ask: v = pq.pop(weight) if v.isVisited != true then ask: v.isVisited = true v.weight = weight call tree.add(v) unvisitedNeighbors = unvisitedNeighbors(v) forEach n in unvisitedNeighbors ask: call pq.push(n, v.weight + g.d(v, n)) next endIf endWhile say("The distance from start to goal is: ".concat(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