Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-release > by-pkgid > 484f7fece98a0938a552c0b7903cfe22 > files > 188

ocaml-ocamlgraph-doc-1.1-1mdv2010.1.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="next" href="Traverse.Bfs.html">
<link rel="Up" href="Traverse.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Sig" rel="Chapter" href="Sig.html">
<link title="Sig_pack" rel="Chapter" href="Sig_pack.html">
<link title="Dot_ast" rel="Chapter" href="Dot_ast.html">
<link title="Util" rel="Chapter" href="Util.html">
<link title="Persistent" rel="Chapter" href="Persistent.html">
<link title="Imperative" rel="Chapter" href="Imperative.html">
<link title="Delaunay" rel="Chapter" href="Delaunay.html">
<link title="Builder" rel="Chapter" href="Builder.html">
<link title="Classic" rel="Chapter" href="Classic.html">
<link title="Rand" rel="Chapter" href="Rand.html">
<link title="Oper" rel="Chapter" href="Oper.html">
<link title="Path" rel="Chapter" href="Path.html">
<link title="Traverse" rel="Chapter" href="Traverse.html">
<link title="Coloring" rel="Chapter" href="Coloring.html">
<link title="Topological" rel="Chapter" href="Topological.html">
<link title="Components" rel="Chapter" href="Components.html">
<link title="Kruskal" rel="Chapter" href="Kruskal.html">
<link title="Flow" rel="Chapter" href="Flow.html">
<link title="Graphviz" rel="Chapter" href="Graphviz.html">
<link title="Gml" rel="Chapter" href="Gml.html">
<link title="Dot" rel="Chapter" href="Dot.html">
<link title="Pack" rel="Chapter" href="Pack.html">
<link title="Gmap" rel="Chapter" href="Gmap.html">
<link title="Minsep" rel="Chapter" href="Minsep.html">
<link title="Cliquetree" rel="Chapter" href="Cliquetree.html">
<link title="Mcs_m" rel="Chapter" href="Mcs_m.html">
<link title="Md" rel="Chapter" href="Md.html">
<link title="Strat" rel="Chapter" href="Strat.html"><link title="Classical big-step iterators" rel="Section" href="#2_Classicalbigstepiterators">
<link title="Step-by-step iterator" rel="Section" href="#2_Stepbystepiterator">
<link title="Cycle detection" rel="Section" href="#2_Cycledetection">
<title>Traverse.Dfs</title>
</head>
<body>
<div class="navbar">&nbsp;<a href="Traverse.html">Up</a>
&nbsp;<a href="Traverse.Bfs.html">Next</a>
</div>
<center><h1>Functor <a href="type_Traverse.Dfs.html">Traverse.Dfs</a></h1></center>
<br>
<pre><span class="keyword">module</span> Dfs: <div class="sig_block"><code class="code">functor (</code><code class="code">G</code><code class="code"> : </code><code class="type"><a href="Traverse.G.html">G</a></code><code class="code">) -&gt; </code><code class="code">sig</code> <a href="Traverse.Dfs.html">..</a> <code class="code">end</code></div></pre>Depth-first search<br>
<table border="0" cellpadding="3" width="100%">
<tr>
<td align="left" valign="top" width="1%%"><b>Parameters: </b></td>
<td>
<table class="paramstable">
<tr>
<td align="center" valign="top" width="15%">
<code>G</code></td>
<td align="center" valign="top">:</td>
<td><code class="type"><a href="Traverse.G.html">G</a></code>
</table>
</td>
</tr>
</table>
<hr width="100%">
<br>
<a name="2_Classicalbigstepiterators"></a>
<h2>Classical big-step iterators</h2><br>
<pre><span class="keyword">val</span> <a name="VALiter"></a>iter : <code class="type">?pre:(G.V.t -> unit) -> ?post:(G.V.t -> unit) -> <a href="Traverse.G.html#TYPEt">Traverse.G.t</a> -> unit</code></pre><div class="info">
<code class="code">iter pre post g</code> visits all nodes of <code class="code">g</code> in depth-first search, 
	 applying <code class="code">pre</code> to each visited node before its successors,
	 and <code class="code">post</code> after them. Each node is visited exactly once. 
         Not tail-recursive.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALprefix"></a>prefix : <code class="type">(G.V.t -> unit) -> <a href="Traverse.G.html#TYPEt">Traverse.G.t</a> -> unit</code></pre><div class="info">
applies only a prefix function; note that this function is more
      efficient than <code class="code">iter</code> and is tail-recursive.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALpostfix"></a>postfix : <code class="type">(G.V.t -> unit) -> <a href="Traverse.G.html#TYPEt">Traverse.G.t</a> -> unit</code></pre><div class="info">
applies only a postfix function. Not tail-recursive.<br>
</div>
<br>
Same thing, but for a single connected component
      (only <code class="code">prefix_component</code> is tail-recursive)<br>
<pre><span class="keyword">val</span> <a name="VALiter_component"></a>iter_component : <code class="type">?pre:(G.V.t -> unit) -><br>       ?post:(G.V.t -> unit) -> <a href="Traverse.G.html#TYPEt">Traverse.G.t</a> -> G.V.t -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALprefix_component"></a>prefix_component : <code class="type">(G.V.t -> unit) -> <a href="Traverse.G.html#TYPEt">Traverse.G.t</a> -> G.V.t -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALpostfix_component"></a>postfix_component : <code class="type">(G.V.t -> unit) -> <a href="Traverse.G.html#TYPEt">Traverse.G.t</a> -> G.V.t -> unit</code></pre><br>
<a name="2_Stepbystepiterator"></a>
<h2>Step-by-step iterator</h2>
<p>

    This is a variant of the iterators above where you can move on
    step by step. The abstract type <code class="code">iterator</code> represents the current
    state of the iteration. The <code class="code">step</code> function returns the next state. 
    In each state, function <code class="code">get</code> returns the currently visited vertex.
    On the final state both <code class="code">get</code> and <code class="code">step</code> raises exception <code class="code">Exit</code>. 
<p>

    Note: the iterator type is persistent (i.e. is not modified by the 
    <code class="code">step</code> function) and thus can be used in backtracking algorithms.<br>
<pre><span class="keyword">type</span> <a name="TYPEiterator"></a><code class="type"></code>iterator </pre>
<div class="info">
(h, st, g) where h is the set of marked vertices and st the stack
	  invariant: the first element of st is not in h i.e. to be visited<br>
</div>

<pre><span class="keyword">val</span> <a name="VALstart"></a>start : <code class="type"><a href="Traverse.G.html#TYPEt">Traverse.G.t</a> -> <a href="Traverse.Dfs.html#TYPEiterator">iterator</a></code></pre><pre><span class="keyword">val</span> <a name="VALstep"></a>step : <code class="type"><a href="Traverse.Dfs.html#TYPEiterator">iterator</a> -> <a href="Traverse.Dfs.html#TYPEiterator">iterator</a></code></pre><pre><span class="keyword">val</span> <a name="VALget"></a>get : <code class="type"><a href="Traverse.Dfs.html#TYPEiterator">iterator</a> -> G.V.t</code></pre><br>
<a name="2_Cycledetection"></a>
<h2>Cycle detection</h2><br>
<pre><span class="keyword">val</span> <a name="VALhas_cycle"></a>has_cycle : <code class="type"><a href="Traverse.G.html#TYPEt">Traverse.G.t</a> -> bool</code></pre><div class="info">
<code class="code">has_cycle g</code> checks for a cycle in <code class="code">g</code>. Linear in time and space.<br>
</div>
</body></html>