Content deleted Content added
Reverted 1 edit by 137.132.228.35 (talk): Rv linkspam. (TW) |
Tags: Mobile edit Mobile web edit |
||
Line 6:
==Redundancy==
Unlike tree traversal, graph traversal may require that some vertices be visited more than once, since it is not necessarily known before transitioning
Thus, it is usually necessary to remember which vertices have already been explored by the algorithm, so that vertices are revisited as infrequently as possible (or in the worst case, to prevent the traversal from continuing indefinitely). This may be accomplished by associating each vertex of the graph with a "color" or "visitation" state during the traversal, which is then checked and updated as the algorithm visits each vertex. If the vertex has already been visited, it is ignored and the path is pursued no further; otherwise, the algorithm checks/updates the vertex and continues down its current path.
|