<!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="Up" href="Builder.S.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="Graph structure" rel="Section" href="#2_Graphstructure"> <link title="Size functions" rel="Section" href="#2_Sizefunctions"> <link title="Membership functions" rel="Section" href="#2_Membershipfunctions"> <link title="Successors and predecessors" rel="Section" href="#2_Successorsandpredecessors"> <link title="Graph iterators" rel="Section" href="#2_Graphiterators"> <link title="Vertex iterators" rel="Section" href="#2_Vertexiterators"> <title>Builder.S.G</title> </head> <body> <div class="navbar"> <a href="Builder.S.html">Up</a> </div> <center><h1>Module <a href="type_Builder.S.G.html">Builder.S.G</a></h1></center> <br> <pre><span class="keyword">module</span> G: <code class="type"><a href="Sig.G.html">Sig.G</a></code><code class="type"> </code></pre><hr width="100%"> <br> <a name="2_Graphstructure"></a> <h2>Graph structure</h2><br> <pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre> <div class="info"> Abstract type of graphs<br> </div> <pre><span class="keyword">module</span> <a href="Sig.G.V.html">V</a>: <code class="type"><a href="Sig.VERTEX.html">Sig.VERTEX</a></code><code class="type"> </code></pre><div class="info"> Vertices have type <code class="code">V.t</code> and are labeled with type <code class="code">V.label</code> (note that an implementation may identify the vertex with its label) </div> <pre><span class="keyword">type</span> <a name="TYPEvertex"></a><code class="type"></code>vertex = <code class="type">V.t</code> </pre> <pre><span class="keyword">module</span> <a href="Sig.G.E.html">E</a>: <code class="type"><a href="Sig.EDGE.html">Sig.EDGE</a></code><code class="type"> with type vertex = vertex</code></pre><div class="info"> Edges have type <code class="code">E.t</code> and are labeled with type <code class="code">E.label</code>. </div> <pre><span class="keyword">type</span> <a name="TYPEedge"></a><code class="type"></code>edge = <code class="type">E.t</code> </pre> <pre><span class="keyword">val</span> <a name="VALis_directed"></a>is_directed : <code class="type">bool</code></pre><div class="info"> Is this an implementation of directed graphs?<br> </div> <br> <a name="2_Sizefunctions"></a> <h2>Size functions</h2><br> <pre><span class="keyword">val</span> <a name="VALis_empty"></a>is_empty : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALnb_vertex"></a>nb_vertex : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> int</code></pre><pre><span class="keyword">val</span> <a name="VALnb_edges"></a>nb_edges : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> int</code></pre><br> Degree of a vertex<br> <pre><span class="keyword">val</span> <a name="VALout_degree"></a>out_degree : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> int</code></pre><div class="info"> <code class="code">out_degree g v</code> returns the out-degree of <code class="code">v</code> in <code class="code">g</code>.<br> <b>Raises</b> <code>Invalid_argument</code> if <code class="code">v</code> is not in <code class="code">g</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALin_degree"></a>in_degree : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> int</code></pre><div class="info"> <code class="code">in_degree g v</code> returns the in-degree of <code class="code">v</code> in <code class="code">g</code>.<br> <b>Raises</b> <code>Invalid_argument</code> if <code class="code">v</code> is not in <code class="code">g</code>.<br> </div> <br> <a name="2_Membershipfunctions"></a> <h2>Membership functions</h2><br> <pre><span class="keyword">val</span> <a name="VALmem_vertex"></a>mem_vertex : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALmem_edge"></a>mem_edge : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALmem_edge_e"></a>mem_edge_e : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEedge">edge</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALfind_edge"></a>find_edge : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> <a href="Sig.G.html#TYPEedge">edge</a></code></pre><div class="info"> <code class="code">find_edge g v1 v2</code> returns the edge from <code class="code">v1</code> to <code class="code">v2</code> if it exists. Unspecified behaviour if <code class="code">g</code> has several edges from <code class="code">v1</code> to <code class="code">v2</code>.<br> <b>Raises</b> <code>Not_found</code> if no such edge exists.<br> </div> <br> <a name="2_Successorsandpredecessors"></a> <h2>Successors and predecessors</h2> <p> You should better use iterators on successors/predecessors (see Section "Vertex iterators").<br> <pre><span class="keyword">val</span> <a name="VALsucc"></a>succ : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> list</code></pre><div class="info"> <code class="code">succ g v</code> returns the successors of <code class="code">v</code> in <code class="code">g</code>.<br> <b>Raises</b> <code>Invalid_argument</code> if <code class="code">v</code> is not in <code class="code">g</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALpred"></a>pred : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> list</code></pre><div class="info"> <code class="code">pred g v</code> returns the predecessors of <code class="code">v</code> in <code class="code">g</code>.<br> <b>Raises</b> <code>Invalid_argument</code> if <code class="code">v</code> is not in <code class="code">g</code>.<br> </div> <br> Labeled edges going from/to a vertex<br> <pre><span class="keyword">val</span> <a name="VALsucc_e"></a>succ_e : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> <a href="Sig.G.html#TYPEedge">edge</a> list</code></pre><div class="info"> <code class="code">succ_e g v</code> returns the edges going from <code class="code">v</code> in <code class="code">g</code>.<br> <b>Raises</b> <code>Invalid_argument</code> if <code class="code">v</code> is not in <code class="code">g</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALpred_e"></a>pred_e : <code class="type"><a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> <a href="Sig.G.html#TYPEedge">edge</a> list</code></pre><div class="info"> <code class="code">pred_e g v</code> returns the edges going to <code class="code">v</code> in <code class="code">g</code>.<br> <b>Raises</b> <code>Invalid_argument</code> if <code class="code">v</code> is not in <code class="code">g</code>.<br> </div> <br> <a name="2_Graphiterators"></a> <h2>Graph iterators</h2><br> <pre><span class="keyword">val</span> <a name="VALiter_vertex"></a>iter_vertex : <code class="type">(<a href="Sig.G.html#TYPEvertex">vertex</a> -> unit) -> <a href="Sig.G.html#TYPEt">t</a> -> unit</code></pre><div class="info"> Iter on all vertices of a graph.<br> </div> <pre><span class="keyword">val</span> <a name="VALfold_vertex"></a>fold_vertex : <code class="type">(<a href="Sig.G.html#TYPEvertex">vertex</a> -> 'a -> 'a) -> <a href="Sig.G.html#TYPEt">t</a> -> 'a -> 'a</code></pre><div class="info"> Fold on all vertices of a graph.<br> </div> <pre><span class="keyword">val</span> <a name="VALiter_edges"></a>iter_edges : <code class="type">(<a href="Sig.G.html#TYPEvertex">vertex</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> unit) -> <a href="Sig.G.html#TYPEt">t</a> -> unit</code></pre><div class="info"> Iter on all edges of a graph. Edge label is ignored.<br> </div> <pre><span class="keyword">val</span> <a name="VALfold_edges"></a>fold_edges : <code class="type">(<a href="Sig.G.html#TYPEvertex">vertex</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> 'a -> 'a) -> <a href="Sig.G.html#TYPEt">t</a> -> 'a -> 'a</code></pre><div class="info"> Fold on all edges of a graph. Edge label is ignored.<br> </div> <pre><span class="keyword">val</span> <a name="VALiter_edges_e"></a>iter_edges_e : <code class="type">(<a href="Sig.G.html#TYPEedge">edge</a> -> unit) -> <a href="Sig.G.html#TYPEt">t</a> -> unit</code></pre><div class="info"> Iter on all edges of a graph.<br> </div> <pre><span class="keyword">val</span> <a name="VALfold_edges_e"></a>fold_edges_e : <code class="type">(<a href="Sig.G.html#TYPEedge">edge</a> -> 'a -> 'a) -> <a href="Sig.G.html#TYPEt">t</a> -> 'a -> 'a</code></pre><div class="info"> Fold on all edges of a graph.<br> </div> <pre><span class="keyword">val</span> <a name="VALmap_vertex"></a>map_vertex : <code class="type">(<a href="Sig.G.html#TYPEvertex">vertex</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a>) -> <a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEt">t</a></code></pre><div class="info"> Map on all vertices of a graph.<br> </div> <br> <a name="2_Vertexiterators"></a> <h2>Vertex iterators</h2> <p> Each iterator <code class="code">iterator f v g</code> iters <code class="code">f</code> to the successors/predecessors of <code class="code">v</code> in the graph <code class="code">g</code> and raises <code class="code">Invalid_argument</code> if <code class="code">v</code> is not in <code class="code">g</code>. It is the same for functions <code class="code">fold_*</code> which use an additional accumulator. <p> <b>Time complexity for ocamlgraph implementations:</b> operations on successors are in O(1) amortized for imperative graphs and in O(ln(|V|)) for persistent graphs while operations on predecessors are in O(max(|V|,|E|)) for imperative graphs and in O(max(|V|,|E|)*ln|V|) for persistent graphs.<br> <br> iter/fold on all successors/predecessors of a vertex.<br> <pre><span class="keyword">val</span> <a name="VALiter_succ"></a>iter_succ : <code class="type">(<a href="Sig.G.html#TYPEvertex">vertex</a> -> unit) -> <a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALiter_pred"></a>iter_pred : <code class="type">(<a href="Sig.G.html#TYPEvertex">vertex</a> -> unit) -> <a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALfold_succ"></a>fold_succ : <code class="type">(<a href="Sig.G.html#TYPEvertex">vertex</a> -> 'a -> 'a) -> <a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> 'a -> 'a</code></pre><pre><span class="keyword">val</span> <a name="VALfold_pred"></a>fold_pred : <code class="type">(<a href="Sig.G.html#TYPEvertex">vertex</a> -> 'a -> 'a) -> <a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> 'a -> 'a</code></pre><br> iter/fold on all edges going from/to a vertex.<br> <pre><span class="keyword">val</span> <a name="VALiter_succ_e"></a>iter_succ_e : <code class="type">(<a href="Sig.G.html#TYPEedge">edge</a> -> unit) -> <a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALfold_succ_e"></a>fold_succ_e : <code class="type">(<a href="Sig.G.html#TYPEedge">edge</a> -> 'a -> 'a) -> <a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> 'a -> 'a</code></pre><pre><span class="keyword">val</span> <a name="VALiter_pred_e"></a>iter_pred_e : <code class="type">(<a href="Sig.G.html#TYPEedge">edge</a> -> unit) -> <a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALfold_pred_e"></a>fold_pred_e : <code class="type">(<a href="Sig.G.html#TYPEedge">edge</a> -> 'a -> 'a) -> <a href="Sig.G.html#TYPEt">t</a> -> <a href="Sig.G.html#TYPEvertex">vertex</a> -> 'a -> 'a</code></pre></body></html>