search

Pseudo Code

function GRAPH-SEARCH(problem) returns a solution, or failure
	initialize the frontier using the initial state of problem
	initialize the explored set to be empty
	loop do
		if the frontier is empty then
			return failure
		choose a leaf node and remove it from the frontier
		if the node contains a goal state then
			return the corresponding solution
		add the node to the explored set
		if chosen node not in the frontier or explored set then
			expand the chosen node, adding the resulting nodes to the frontier