we'll use to run few searches in the graph example - pp \dstruct\classics\gtestfunc py "dictionary based graph representationgraph {' '' '' '' '' '' '' '[' '' '' '][' '][' '' '][' '][' '' '' ']][' ' directedcyclic graph stored as dictionary 'keyleads-to [nodesdef tests(searcher)test searcher function print(searcher(' '' 'graph)find all paths from 'eto 'dfor in ['ag''gf''ba''da']print(xsearcher( [ ] [ ]graph)nowlet' code two modules that implement the actual search algorithms they are both independent of the graph to be searched (it is passed in as an argumentthe first searcherin example - uses recursion to walk through the graph example - pp \dstruct\classics\gsearch py "find all paths from start to goal in graphdef search(startgoalgraph)solns [generate([start]goalsolnsgraphsolns sort(key=lambda xlen( )return solns collect paths sort by path length def generate(pathgoalsolnsgraph)state path[- if state =goalfound goal here solns append(pathchange solns in-place elsecheck all arcs here for arc in graph[state]skip cycles on path if arc not in pathgenerate(path [arc]goalsolnsgraphif __name__ ='__main__'import gtestfunc gtestfunc tests(searchthe second searcherin example - uses an explicit stack of paths to be expanded using the tuple-tree stack representation we explored earlier in this graph searching