Computer Science, asked by tejamummidi8450, 1 year ago

Difference between traversal method and search method

Answers

Answered by Abhishek75700
3
⛤☛☺Generally non-tree graphs are thought of as possibly (but not necessarily) cyclic, can be composed of multiple parts, and can have bidirectional edges.
⛤☛☺So if you want to traverse either data structure (i.e. make sure you hit all the elements), there can be different approaches based on the definition and data set.
⛤☺☛The primary one is that with most graphs (especially ones with bidirectional edges) traversals require you to in some way track past visited vertices so you don't end up in an infinite loop (because of their often cyclical nature).
⛤⛤☛☺The only other difference that comes to mind is if some or all of the edges were monodirectional, you could start within a cyclic part of the graph that was technically reachable from outside that cluster of vertices/nodes, but was impossible to leave. So you might have to use something like the disconnected logic if it has monodirectional edges (although I don't think this is very common).☺☺☺☺⛤⛤⛤⛤⛤⛤⛤⛤⛤⛤⛤⛤⛤⛤⛤♔♔⛤⛤⛤⛤⛤⛤☺☺☺☺☺☜☜☜
Attachments:
Similar questions