<!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="Sig_pack.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="Graph constructors and destructors" rel="Section" href="#2_Graphconstructorsanddestructors"> <link title="Size functions" rel="Section" href="#2_Sizefunctions"> <link title="Membership functions" rel="Section" href="#2_Membershipfunctions"> <link title="Successors and predecessors of a vertex" rel="Section" href="#2_Successorsandpredecessorsofavertex"> <link title="Graph iterators" rel="Section" href="#2_Graphiterators"> <link title="Vertex iterators" rel="Section" href="#2_Vertexiterators"> <link title="Basic operations" rel="Section" href="#2_Basicoperations"> <link title="Traversal" rel="Section" href="#2_Traversal"> <link title="Graph generators" rel="Section" href="#2_Graphgenerators"> <link title="Classical algorithms" rel="Section" href="#2_Classicalalgorithms"> <link title="Input / Output" rel="Section" href="#2_InputOutput"> <title>Sig_pack.S</title> </head> <body> <div class="navbar"> <a href="Sig_pack.html">Up</a> </div> <center><h1>Module type <a href="type_Sig_pack.S.html">Sig_pack.S</a></h1></center> <br> <pre><span class="keyword">module type</span> S = <code class="code">sig</code> <a href="Sig_pack.S.html">..</a> <code class="code">end</code></pre>Signature gathering an imperative graph signature and all algorithms. Vertices and edges are labeled with integers.<br> <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_pack.S.V.html">V</a>: <code class="code">sig</code> <a href="Sig_pack.S.V.html">..</a> <code class="code">end</code></pre><div class="info"> Vertices </div> <pre><span class="keyword">type</span> <a name="TYPEvertex"></a><code class="type"></code>vertex = <code class="type"><a href="Sig_pack.S.V.html#TYPEt">V.t</a></code> </pre> <pre><span class="keyword">module</span> <a href="Sig_pack.S.E.html">E</a>: <code class="code">sig</code> <a href="Sig_pack.S.E.html">..</a> <code class="code">end</code></pre><div class="info"> Edges </div> <pre><span class="keyword">type</span> <a name="TYPEedge"></a><code class="type"></code>edge = <code class="type"><a href="Sig_pack.S.E.html#TYPEt">E.t</a></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_Graphconstructorsanddestructors"></a> <h2>Graph constructors and destructors</h2><br> <pre><span class="keyword">val</span> <a name="VALcreate"></a>create : <code class="type">?size:int -> unit -> <a href="Sig_pack.S.html#TYPEt">t</a></code></pre><div class="info"> Return an empty graph. Optionally, a size can be given, which should be on the order of the expected number of vertices that will be in the graph (for hash tables-based implementations). The graph grows as needed, so <code class="code">size</code> is just an initial guess.<br> </div> <pre><span class="keyword">val</span> <a name="VALcopy"></a>copy : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">copy g</code> returns a copy of <code class="code">g</code>. Vertices and edges (and eventually marks, see module <code class="code">Mark</code>) are duplicated.<br> </div> <pre><span class="keyword">val</span> <a name="VALadd_vertex"></a>add_vertex : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> unit</code></pre><div class="info"> <code class="code">add_vertex g v</code> adds the vertex <code class="code">v</code> from the graph <code class="code">g</code>. Do nothing if <code class="code">v</code> is already in <code class="code">g</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALremove_vertex"></a>remove_vertex : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> unit</code></pre><div class="info"> <code class="code">remove g v</code> removes the vertex <code class="code">v</code> from the graph <code class="code">g</code> (and all the edges going from <code class="code">v</code> in <code class="code">g</code>). Do nothing if <code class="code">v</code> is not in <code class="code">g</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALadd_edge"></a>add_edge : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> unit</code></pre><div class="info"> <code class="code">add_edge g v1 v2</code> adds an edge from the vertex <code class="code">v1</code> to the vertex <code class="code">v2</code> in the graph <code class="code">g</code>. Add also <code class="code">v1</code> (resp. <code class="code">v2</code>) in <code class="code">g</code> if <code class="code">v1</code> (resp. <code class="code">v2</code>) is not in <code class="code">g</code>. Do nothing if this edge is already in <code class="code">g</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALadd_edge_e"></a>add_edge_e : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.E.html#TYPEt">E.t</a> -> unit</code></pre><div class="info"> <code class="code">add_edge_e g e</code> adds the edge <code class="code">e</code> in the graph <code class="code">g</code>. Add also <code class="code">E.src e</code> (resp. <code class="code">E.dst e</code>) in <code class="code">g</code> if <code class="code">E.src e</code> (resp. <code class="code">E.dst e</code>) is not in <code class="code">g</code>. Do nothing if <code class="code">e</code> is already in <code class="code">g</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALremove_edge"></a>remove_edge : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> unit</code></pre><div class="info"> <code class="code">remove_edge g v1 v2</code> removes the edge going from <code class="code">v1</code> to <code class="code">v2</code> from the graph <code class="code">g</code>. Do nothing if this edge is not in <code class="code">g</code>.<br> <b>Raises</b> <code>Invalid_argument</code> if <code class="code">v1</code> or <code class="code">v2</code> are not in <code class="code">g</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALremove_edge_e"></a>remove_edge_e : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.E.html#TYPEt">E.t</a> -> unit</code></pre><div class="info"> <code class="code">remove_edge_e g e</code> removes the edge <code class="code">e</code> from the graph <code class="code">g</code>. Do nothing if <code class="code">e</code> is not in <code class="code">g</code>.<br> <b>Raises</b> <code>Invalid_argument</code> if <code class="code">E.src e</code> or <code class="code">E.dst e</code> are not in <code class="code">g</code>.<br> </div> <pre><span class="keyword">module</span> <a href="Sig_pack.S.Mark.html">Mark</a>: <code class="code">sig</code> <a href="Sig_pack.S.Mark.html">..</a> <code class="code">end</code></pre><div class="info"> Vertices contains integers marks, which can be set or used by some algorithms (see for instance module <code class="code">Marking</code> below) </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_pack.S.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_pack.S.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_pack.S.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_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</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_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</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_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALmem_edge"></a>mem_edge : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</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_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.E.html#TYPEt">E.t</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALfind_edge"></a>find_edge : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.E.html#TYPEt">E.t</a></code></pre><br> <a name="2_Successorsandpredecessorsofavertex"></a> <h2>Successors and predecessors of a vertex</h2><br> <pre><span class="keyword">val</span> <a name="VALsucc"></a>succ : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</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_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</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_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.E.html#TYPEt">E.t</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_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.E.html#TYPEt">E.t</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> <br> iter/fold on all vertices/edges of a graph<br> <pre><span class="keyword">val</span> <a name="VALiter_vertex"></a>iter_vertex : <code class="type">(<a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> unit) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALiter_edges"></a>iter_edges : <code class="type">(<a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> unit) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALfold_vertex"></a>fold_vertex : <code class="type">(<a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> 'a -> 'a) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> 'a -> 'a</code></pre><pre><span class="keyword">val</span> <a name="VALfold_edges"></a>fold_edges : <code class="type">(<a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> 'a -> 'a) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> 'a -> 'a</code></pre><pre><span class="keyword">val</span> <a name="VALmap_vertex"></a>map_vertex : <code class="type">(<a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a>) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.html#TYPEt">t</a></code></pre><div class="info"> map iterator on vertex<br> </div> <br> iter/fold on all labeled edges of a graph<br> <pre><span class="keyword">val</span> <a name="VALiter_edges_e"></a>iter_edges_e : <code class="type">(<a href="Sig_pack.S.E.html#TYPEt">E.t</a> -> unit) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALfold_edges_e"></a>fold_edges_e : <code class="type">(<a href="Sig_pack.S.E.html#TYPEt">E.t</a> -> 'a -> 'a) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> 'a -> 'a</code></pre><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>.<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_pack.S.V.html#TYPEt">V.t</a> -> unit) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALiter_pred"></a>iter_pred : <code class="type">(<a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> unit) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALfold_succ"></a>fold_succ : <code class="type">(<a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> 'a -> 'a) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> 'a -> 'a</code></pre><pre><span class="keyword">val</span> <a name="VALfold_pred"></a>fold_pred : <code class="type">(<a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> 'a -> 'a) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</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_pack.S.E.html#TYPEt">E.t</a> -> unit) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</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_pack.S.E.html#TYPEt">E.t</a> -> 'a -> 'a) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</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_pack.S.E.html#TYPEt">E.t</a> -> unit) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</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_pack.S.E.html#TYPEt">E.t</a> -> 'a -> 'a) -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> 'a -> 'a</code></pre><br> <a name="2_Basicoperations"></a> <h2>Basic operations</h2><br> <pre><span class="keyword">val</span> <a name="VALfind_vertex"></a>find_vertex : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> int -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a></code></pre><div class="info"> <code class="code">vertex g i</code> returns a vertex of label <code class="code">i</code> in <code class="code">g</code>. The behaviour is unspecified if <code class="code">g</code> has several vertices with label <code class="code">i</code>. Note: this function is inefficient (linear in the number of vertices); you should better keep the vertices as long as you create them.<br> </div> <pre><span class="keyword">val</span> <a name="VALtransitive_closure"></a>transitive_closure : <code class="type">?reflexive:bool -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">transitive_closure ?reflexive g</code> returns the transitive closure of <code class="code">g</code> (as a new graph). Loops (i.e. edges from a vertex to itself) are added only if <code class="code">reflexive</code> is <code class="code">true</code> (default is <code class="code">false</code>).<br> </div> <pre><span class="keyword">val</span> <a name="VALadd_transitive_closure"></a>add_transitive_closure : <code class="type">?reflexive:bool -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">add_transitive_closure ?reflexive g</code> replaces <code class="code">g</code> by its transitive closure. Meaningless for persistent implementations (then acts as <code class="code">transitive_closure</code>).<br> </div> <pre><span class="keyword">val</span> <a name="VALmirror"></a>mirror : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">mirror g</code> returns a new graph which is the mirror image of <code class="code">g</code>: each edge from <code class="code">u</code> to <code class="code">v</code> has been replaced by an edge from <code class="code">v</code> to <code class="code">u</code>. For undirected graphs, it simply returns a copy of <code class="code">g</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALcomplement"></a>complement : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">complement g</code> builds a new graph which is the complement of <code class="code">g</code>: each edge present in <code class="code">g</code> is not present in the resulting graph and vice-versa. Edges of the returned graph are unlabeled.<br> </div> <pre><span class="keyword">val</span> <a name="VALintersect"></a>intersect : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">intersect g1 g2</code> returns a new graph which is the intersection of <code class="code">g1</code> and <code class="code">g2</code>: each vertex and edge present in <code class="code">g1</code> *and* <code class="code">g2</code> is present in the resulting graph.<br> </div> <pre><span class="keyword">val</span> <a name="VALunion"></a>union : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">union g1 g2</code> returns a new graph which is the union of <code class="code">g1</code> and <code class="code">g2</code>: each vertex and edge present in <code class="code">g1</code> *or* <code class="code">g2</code> is present in the resulting graph.<br> </div> <br> <a name="2_Traversal"></a> <h2>Traversal</h2><br> <pre><span class="keyword">module</span> <a href="Sig_pack.S.Dfs.html">Dfs</a>: <code class="code">sig</code> <a href="Sig_pack.S.Dfs.html">..</a> <code class="code">end</code></pre><div class="info"> Depth-first search </div> <pre><span class="keyword">module</span> <a href="Sig_pack.S.Bfs.html">Bfs</a>: <code class="code">sig</code> <a href="Sig_pack.S.Bfs.html">..</a> <code class="code">end</code></pre><div class="info"> Breadth-first search </div> <pre><span class="keyword">module</span> <a href="Sig_pack.S.Marking.html">Marking</a>: <code class="code">sig</code> <a href="Sig_pack.S.Marking.html">..</a> <code class="code">end</code></pre><div class="info"> Graph traversal with marking </div> <br> <a name="2_Graphgenerators"></a> <h2>Graph generators</h2><br> <pre><span class="keyword">module</span> <a href="Sig_pack.S.Classic.html">Classic</a>: <code class="code">sig</code> <a href="Sig_pack.S.Classic.html">..</a> <code class="code">end</code></pre><div class="info"> Classic graphs </div> <pre><span class="keyword">module</span> <a href="Sig_pack.S.Rand.html">Rand</a>: <code class="code">sig</code> <a href="Sig_pack.S.Rand.html">..</a> <code class="code">end</code></pre><div class="info"> Random graphs </div> <pre><span class="keyword">module</span> <a href="Sig_pack.S.Components.html">Components</a>: <code class="code">sig</code> <a href="Sig_pack.S.Components.html">..</a> <code class="code">end</code></pre><div class="info"> Strongly connected components </div> <br> <a name="2_Classicalalgorithms"></a> <h2>Classical algorithms</h2><br> <pre><span class="keyword">val</span> <a name="VALshortest_path"></a>shortest_path : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.E.html#TYPEt">E.t</a> list * int</code></pre><div class="info"> Dijkstra's shortest path algorithm. Weights are the labels.<br> </div> <pre><span class="keyword">val</span> <a name="VALford_fulkerson"></a>ford_fulkerson : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -><br> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> (<a href="Sig_pack.S.E.html#TYPEt">E.t</a> -> int) * int</code></pre><div class="info"> Ford Fulkerson maximum flow algorithm<br> </div> <pre><span class="keyword">val</span> <a name="VALgoldberg"></a>goldberg : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -><br> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> <a href="Sig_pack.S.V.html#TYPEt">V.t</a> -> (<a href="Sig_pack.S.E.html#TYPEt">E.t</a> -> int) * int</code></pre><div class="info"> Goldberg maximum flow algorithm<br> </div> <pre><span class="keyword">module</span> <a href="Sig_pack.S.PathCheck.html">PathCheck</a>: <code class="code">sig</code> <a href="Sig_pack.S.PathCheck.html">..</a> <code class="code">end</code></pre><div class="info"> Path checking </div> <pre><span class="keyword">module</span> <a href="Sig_pack.S.Topological.html">Topological</a>: <code class="code">sig</code> <a href="Sig_pack.S.Topological.html">..</a> <code class="code">end</code></pre><div class="info"> Topological order </div> <pre><span class="keyword">val</span> <a name="VALspanningtree"></a>spanningtree : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> <a href="Sig_pack.S.E.html#TYPEt">E.t</a> list</code></pre><div class="info"> Kruskal algorithm<br> </div> <br> <a name="2_InputOutput"></a> <h2>Input / Output</h2><br> <pre><span class="keyword">val</span> <a name="VALdot_output"></a>dot_output : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> string -> unit</code></pre><div class="info"> DOT output<br> </div> <pre><span class="keyword">val</span> <a name="VALdisplay_with_gv"></a>display_with_gv : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> unit</code></pre><div class="info"> Displays the given graph using the external tools "dot" and "gv" and returns when gv's window is closed<br> </div> <pre><span class="keyword">val</span> <a name="VALparse_gml_file"></a>parse_gml_file : <code class="type">string -> <a href="Sig_pack.S.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALparse_dot_file"></a>parse_dot_file : <code class="type">string -> <a href="Sig_pack.S.html#TYPEt">t</a></code></pre><pre><span class="keyword">val</span> <a name="VALprint_gml_file"></a>print_gml_file : <code class="type"><a href="Sig_pack.S.html#TYPEt">t</a> -> string -> unit</code></pre></body></html>