Extra notes
Download
1 / 6

Extra notes - PowerPoint PPT Presentation


  • 63 Views
  • Uploaded on

Extra notes Modified from Callan R (2003) Artificial Intelligence Palgrave ISBN 0-333-80136-9 pg 50-55. The graph. Psudeocode for BFS. node current; queue toVisit; List alreadyVisited; put root node in toVisit; while toVisit is notEmpty current=first node in toVisit;

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Extra notes' - blake-ramirez


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Extra notes

Modified from Callan R (2003) Artificial Intelligence Palgrave ISBN 0-333-80136-9 pg 50-55



Psudeocode for bfs
Psudeocode for BFS

  • node current;

  • queue toVisit;

  • List alreadyVisited;

  • put root node in toVisit;

  • while toVisit is notEmpty

  • current=first node in toVisit;

  • remove first node in toVisit;

  • if current==goal

  • add current to alreadyVisited;

  • return true;

  • endif

  • for each child node C of current

  • add C to toVisit;

  • endfor;

  • add current to alreadyVisited;

  • endwhile;


  • toVisit alreadyVisited

  • A []

  • BC A

  • CDE AB

  • DEFGH ABC

  • EFGHI ABCD

  • FGHIJK ABCDE

  • GHIJKLM ABCDEF

  • HIJKLM ABCDEFG

  • IJKLMN ABCDEFGH

  • JKLMNO ABCDEFGHI

  • KLMNO ABCDEFGHIJ

  • LMNO ABCDEFGHIJK

  • MNOP ABCDEFGHIJKL

  • NOPQ ABCDEFGHIJKLM

  • OPQ ABCDEFGHIJKLMN

  • PQ ABCDEFGHIJKLMNO

  • Q ABCDEFGHIJKLMNOP

  • [] ABCDEFGHIJKLMNOPQ


Psudeocode for dfs
Psudeocode for DFS

  • node current;

  • stack toVisit;

  • List alreadyVisited;

  • put root node in toVisit;

  • while toVisit is notEmpty

  • current=first node in toVisit;

  • remove first node in toVisit;

  • if current==goal

  • add current to alreadyVisited;

  • return true;

  • endif

  • for each child node C of current

  • add C to toVisit;

  • endfor;

  • add current to alreadyVisited;

  • endwhile;


  • toVisit alreadyVisited

  • A []

  • BC A

  • DEC AB

  • IEC ABD

  • OEC ABDI

  • EC ABDIO

  • JKC ABDIOE

  • KC ABDIOEJ

  • C ABDIOEJK

  • FGH ABDIOEJKC

  • LMGH ABDIOEJKCF

  • PMGH ABDIOEJKCFL

  • MGH ABDIOEJKCFLP

  • QGH ABDIOEJKCFLPM


ad