Re: Depth First Search traversal of this list
- From: "Alex Mizrahi" <udodenko@xxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 12 Sep 2008 01:40:44 +0300
PJB>>> The confusion is between a "search" and a "walk".
??>>
??>> what is "walk" and how is it different from normal dfs traversal?
GN> A walk touches every node of the tree, a search partitions the tree to
GN> avoid touching every node.
partitions??
do you mean it exists as soon as it finds something, while "walk"
visits all node?
this actually makes sense, but people historically(?) refer to it as dfs
even if they are not going to find anything.
for example, NISTS's "Dictionary of Algorithms and Data Structures"
only has an entry for depth-first-search (no depth first walk or whatever):
----
(1) Any search algorithm that considers outgoing edges (children) of a
vertex before any of the vertex's siblings, that is, outgoing edges of the
vertex's predecessor in the search. Extremes are searched first. This is
easily implemented with recursion. (2) An algorithm that marks all vertices
in a directed graph in the order they are discovered and finished,
partitioning the graph into a forest.
Specialization (... is a kind of me.)
preorder traversal, in-order traversal, postorder traversal.
Note: Depth-first search doesn't specify if a vertex is considered before,
during, or after its outgoing edges or children. Thus it can be preorder,
in-order, or postorder traversal.
----
note that specializations are called traversals rather than searches -- i
guess that's later, more precies terminology comparing to original term dfs.
and it's used like that almost everywhere. in wikipedia:
http://en.wikipedia.org/wiki/Depth-first_search
Depth-first search (DFS) is an algorithm for traversing or searching a tree,
tree structure, or graph.
http://en.wikipedia.org/wiki/Topological_sorting
An alternative algorithm for topological sorting is based on depth-first
search. Loop through the vertices of the graph, in any order, initiating a
depth-first search for any vertex that has not already been visited by a
previous search. The desired topological sorting is the reverse postorder of
these searches.
Boost C++ libraries:
The depth_first_search() function performs a depth-first traversal of the
vertices in a directed graph.
also note, wherever they do not use word "search", they use word
"traversal".
so it seems like "walk" is unofficial rarely-used term (try google searches
for depth-first search, traversal and walk, and see the difference), but
Pascal used it as if everybody
should know what "walk" is and how is it different from search.
.
- Follow-Ups:
- Re: Depth First Search traversal of this list
- From: Pascal J. Bourguignon
- Re: Depth First Search traversal of this list
- References:
- Depth First Search traversal of this list
- From: crashoverride111
- Re: Depth First Search traversal of this list
- From: Alberto Riva
- Re: Depth First Search traversal of this list
- From: crashoverride111
- Re: Depth First Search traversal of this list
- From: Pascal J. Bourguignon
- Re: Depth First Search traversal of this list
- From: Alex Mizrahi
- Re: Depth First Search traversal of this list
- From: Pascal J. Bourguignon
- Re: Depth First Search traversal of this list
- From: Alex Mizrahi
- Re: Depth First Search traversal of this list
- From: George Neuner
- Depth First Search traversal of this list
- Prev by Date: Re: What do you LISPers think of Haskell?
- Next by Date: Re: Depth First Search traversal of this list
- Previous by thread: Re: Depth First Search traversal of this list
- Next by thread: Re: Depth First Search traversal of this list
- Index(es):
Relevant Pages
|
|