1 / 6

Extra notes

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;

Download Presentation

Extra notes

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. The graph

  3. 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;

  4. 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

  5. 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;

  6. 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

More Related