<?xml version="1.0" encoding='utf-8'?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Graph traversal - Page 8 - Wikipedia">
<p>
<a accesskey="1" href="page.php?w=graph_traversal&amp;p=7">1.Previous</a><br />
<a accesskey="3" href="page.php?w=graph_traversal&amp;p=9">3.Next</a>
</p>

<p><big>Pseudocode</big></p>
<p>
* Input: A graph G and a vertex v of G.<br/>
* Output: A labeling of the edges in the connected component of v as discovery edges and back edges.</p>

<p> <b>procedure</b> DFS(G, v) <b>is</b>     label v as explored     <b>for all</b> edges e in G.incidentEdges(v) <b>do</b>         <b>if</b> edge e is unexplored <b>then</b>             w <- G</i>.adjacentVertex(v, e)             <b>if</b> vertex w is unexplored <b>then</b>                 label e as a discovered edge                 recursively call DFS(G, w)             <b>else</b>                label e as a back edge</-></p><p>
<a accesskey="1" href="page.php?w=graph_traversal&amp;p=7">1.Previous</a><br />
<a accesskey="3" href="page.php?w=graph_traversal&amp;p=9">3.Next</a>
</p>

<do type="prev" label="Search">
        <go href="search.wml"/>
</do>

</card>
</wml>
