Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

iterator question

2 views
Skip to first unread message

Jeff

unread,
Apr 15, 2005, 10:48:41 AM4/15/05
to
What is the difference between a depth and a breadth iterator?


Peter Bui

unread,
Apr 15, 2005, 12:38:54 PM4/15/05
to
If you were to think of a graph as say a binary tree, breadth is when
you move through the tree level by level.

A
/ \
B C
/ \ / \
D E F G

Order would be:
A -> B -> C -> D -> E -> F -> G

Depth is when you head down the tree completely, so for the same example:

A -> B -> D -> E -> C -> F -> G

Of course for a graph, you will want to check whether or not you have
visited the vertex or not since a vertex can end up going back to itself
while traversing through.

Well, this is what I think these two are suppose to mean. If anyone
else thinks differently, let me know ;)

0 new messages