{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

graph_search

graph_search - Begin While G has a non-visited node v do...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Graph Search Techniques 1- Tree search: Inorder (L N R) Preorder (N L R) Postorder (L N R). 2- Graph search: Given a graph G. Depth-first-search DFS (v) Begin Visited (v) =1; For every node w adjacent to v do If visited (w) = o then DFS (w); End if End for End. Complexity: O(max(n,e))
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
3- Breadth first search: BFS (g). Q: queue ;
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Begin While G has a non-visited node v do. Visited (v) =1 ; Add queue (Q,v) ; While Q ≠ ∅ do. X = remove queue (Q) ; For every adjacent node w of X do. If visited (w)=o Then visited (w)=1 ; add queue (Q,w) ; Endif End for End while End while End. Complexity: O(max(n,e))...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern