{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

graph_search

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

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

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))

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

View Full Document
3- Breadth first search: BFS (g). Q: queue ;
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

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

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

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

Dana University of Pennsylvania ‘17, Course Hero Intern

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

Jill Tulane University ‘16, Course Hero Intern