UNPKG

@ciao-lang/ts-ciao-interface

Version:

Simple Ciao interface for node.

69 lines 19.1 kB
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="theme-color" content="#273f79"/><link rel="stylesheet" href="lpdoc.css" type="text/css"/><script type="text/javascript" src="lpdoc.js"></script><title>Unweighted graph-processing utilities &mdash; The Ciao System v1.22</title></head><body><div class="lpdoc-page fixleftbar"><a href="#" id="sidebar-toggle-button" class="lpdoc-navbutton"><span id="sidebar-button-arrow">&#9776;</span></a><div id="sidebar" class="lpdoc-sidebar"><div style="height: 40px; margin-left: auto; margin-right: auto"><img src="ciao-logo_autofig.png" width=auto height=100%></div><div class="lpdoc-nav"><span class="lpdoc-on-right"><a class="lpdoc-navbutton" href="DataStructuresAlgs.html">&#x2191;</a><a class="lpdoc-navbutton" href="graphs.html">&#x2190;</a><a class="lpdoc-navbutton" href="lgraphs.html">&#x2192;</a><a class="lpdoc-navbutton" href="ciaosearch.html">&#x1F50D;</a></span><span><a href="ciaofulltoc.html">TOC</a></span></div><hr></hr><ul class="lpdoc-itemize-sectpath"><li><a href="ciao.html">The Ciao System</a> &raquo;<br/> </li><li><a href="DataStructuresAlgs.html">PART VI - Data structures and algorithms</a> &raquo;<br/> </li><li><a href=""><strong>Unweighted graph-processing utilities</strong></a></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Usage and interface">Usage and interface</a></li><li><a href="#Documentation on exports">Documentation on exports</a></li><li><a href="#Documentation on imports">Documentation on imports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>Unweighted graph-processing utilities</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#ugraphs"></a> <strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Richard A. O&apos;Keefe" href="ciaosearch.html#Richard A. O&apos;Keefe">Richard A. O&apos;Keefe (original shared code)</a>, <a class="lpdoc-idx-anchor" id="Mats Carlsson" href="ciaosearch.html#Mats Carlsson">Mats Carlsson (adapted from original code)</a>, <a class="lpdoc-idx-anchor" id="Francisco Bueno" href="ciaosearch.html#Francisco Bueno">Francisco Bueno (modifications)</a>, <a class="lpdoc-idx-anchor" id="Manuel Carro" href="ciaosearch.html#Manuel Carro">Manuel Carro (modifications)</a>.<p> An unweighted directed graph (ugraph) is represented as a list of (vertex-neighbors) pairs, where the pairs are in standard order (as produced by keysort with unique keys) and the neighbors of each vertex are also in standard order (as produced by sort), and every neighbor appears as a vertex even if it has no neighbors itself.<p>An undirected graph is represented as a directed graph where for each edge <tt>(U,V)</tt> there is a symmetric edge <tt>(V,U)</tt>.<p>An edge <tt>(U,V)</tt> is represented as the term <tt>U-V</tt>.<p>A vertex can be any term. Two vertices are distinct iff they are not identical (<a class="lpdoc-idx-anchor" id="0" href="term_compare.html#==/2"><tt>==/2</tt></a>).<p>A path is represented as a list of vertices. No vertex can appear twice in a path.<p><br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/><tt>:- use_module(library(graphs/ugraphs)).</tt><li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="1" href="#vertices_edges_to_ugraph/3"><tt>vertices_edges_to_ugraph/3</tt></a>, <a class="lpdoc-idx-anchor" id="2" href="#neighbors/3"><tt>neighbors/3</tt></a>, <a class="lpdoc-idx-anchor" id="3" href="#edges/2"><tt>edges/2</tt></a>, <a class="lpdoc-idx-anchor" id="4" href="#del_edges/3"><tt>del_edges/3</tt></a>, <a class="lpdoc-idx-anchor" id="5" href="#add_edges/3"><tt>add_edges/3</tt></a>, <a class="lpdoc-idx-anchor" id="6" href="#vertices/2"><tt>vertices/2</tt></a>, <a class="lpdoc-idx-anchor" id="7" href="#del_vertices/3"><tt>del_vertices/3</tt></a>, <a class="lpdoc-idx-anchor" id="8" href="#add_vertices/3"><tt>add_vertices/3</tt></a>, <a class="lpdoc-idx-anchor" id="9" href="llists.html#transpose/2"><tt>transpose/2</tt></a>, <a class="lpdoc-idx-anchor" id="10" href="#rooted_subgraph/3"><tt>rooted_subgraph/3</tt></a>, <a class="lpdoc-idx-anchor" id="11" href="#point_to/3"><tt>point_to/3</tt></a>. <li><em>Regular Types:</em><br/><a class="lpdoc-idx-anchor" id="12" href="#ugraph/1"><tt>ugraph/1</tt></a>. </ul></ul></div></div><div id="Documentation on exports"><h2>Documentation on exports</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="vertices_edges_to_ugraph/3" href="ciaosearch.html#vertices_edges_to_ugraph/3">vertices_edges_to_ugraph/3</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="neighbors/3" href="ciaosearch.html#neighbors/3">neighbors/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>neighbors(Vertex,Graph,Neighbors)</tt> </span><p>Is true if <span class="lpdoc-var">Vertex</span> is a vertex in <span class="lpdoc-var">Graph</span> and <span class="lpdoc-var">Neighbors</span> are its neighbors.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="13" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Vertex</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="14" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Graph</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="15" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Neighbors</span> is a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="edges/2" href="ciaosearch.html#edges/2">edges/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>edges(Graph,Edges)</tt> </span><p>Unifies <span class="lpdoc-var">Edges</span> with the edges in <span class="lpdoc-var">Graph</span>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="16" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Graph</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="17" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Edges</span> is a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="del_edges/3" href="ciaosearch.html#del_edges/3">del_edges/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>del_edges(Graph1,Edges,Graph2)</tt> </span><p>Is true if <span class="lpdoc-var">Graph2</span> is <span class="lpdoc-var">Graph1</span> with <span class="lpdoc-var">Edges</span> removed from it.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="18" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Graph1</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="19" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Edges</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="20" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Graph2</span> is a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="add_edges/3" href="ciaosearch.html#add_edges/3">add_edges/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>add_edges(Graph1,Edges,Graph2)</tt> </span><p>Is true if <span class="lpdoc-var">Graph2</span> is <span class="lpdoc-var">Graph1</span> with <span class="lpdoc-var">Edges</span> and their &apos;to&apos; and &apos;from&apos; vertices added to it.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="21" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Graph1</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="22" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Edges</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="23" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Graph2</span> is a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="vertices/2" href="ciaosearch.html#vertices/2">vertices/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>vertices(Graph,Vertices)</tt> </span><p>Unifies <span class="lpdoc-var">Vertices</span> with the vertices in <span class="lpdoc-var">Graph</span>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="24" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Graph</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="25" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Vertices</span> is a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="del_vertices/3" href="ciaosearch.html#del_vertices/3">del_vertices/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>del_vertices(Graph1,Vertices,Graph2)</tt> </span><p>Is true if <span class="lpdoc-var">Graph2</span> is <span class="lpdoc-var">Graph1</span> with <span class="lpdoc-var">Vertices</span> and all edges to and from <span class="lpdoc-var">Vertices</span> removed from it.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="26" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Graph1</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="27" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Vertices</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="28" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Graph2</span> is a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="add_vertices/3" href="ciaosearch.html#add_vertices/3">add_vertices/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>add_vertices(Graph1,Vertices,Graph2)</tt> </span><p>Is true if <span class="lpdoc-var">Graph2</span> is <span class="lpdoc-var">Graph1</span> with <span class="lpdoc-var">Vertices</span> added to it.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="29" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Graph1</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="30" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Vertices</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="31" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Graph2</span> is a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="transpose/2" href="ciaosearch.html#transpose/2">transpose/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>transpose(Graph,Transpose)</tt> </span><p>Is true if <span class="lpdoc-var">Transpose</span> is the graph computed by replacing each edge <tt>(u,v)</tt> in <span class="lpdoc-var">Graph</span> by its symmetric edge <tt>(v,u)</tt>. It can only be used one way around. The cost is O(N^2).</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="32" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Graph</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="33" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Transpose</span> is a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="rooted_subgraph/3" href="ciaosearch.html#rooted_subgraph/3">rooted_subgraph/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>rooted_subgraph(Graph,Sources,SubGraph)</tt> </span><p><span class="lpdoc-var">SubGraph</span> is the subgraph of <span class="lpdoc-var">Graph</span> which is reachable from <span class="lpdoc-var">Sources</span>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="34" href="#ugraph/1"><tt>ugraphs:ugraph/1</tt></a>)</span><span><span class="lpdoc-var">Graph</span> is an ugraph. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="35" href="basic_props.html#list/1"><tt>basic_props:list/1</tt></a>)</span><span><span class="lpdoc-var">Sources</span> is a list. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="36" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">SubGraph</span> is a free variable. </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="37" href="#ugraph/1"><tt>ugraphs:ugraph/1</tt></a>)</span><span><span class="lpdoc-var">SubGraph</span> is an ugraph. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="point_to/3" href="ciaosearch.html#point_to/3">point_to/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>point_to(Vertex,Graph,Point_to)</tt> </span><p>Is true if <span class="lpdoc-var">Point_to</span> is the list of nodes which go directly to <span class="lpdoc-var">Vertex</span> in <span class="lpdoc-var">Graph</span>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="38" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Vertex</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="39" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Graph</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="40" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Point_to</span> is a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="ugraph/1" href="ciaosearch.html#ugraph/1">ugraph/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>ugraph(Graph)</tt> </span><p><span class="lpdoc-var">Graph</span> is an ugraph.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> </div><div id="Documentation on imports"><h2>Documentation on imports</h2>This module has the following direct dependencies:<ul class="lpdoc-itemize-minus"><li><em>System library modules:</em><br/><a class="lpdoc-idx-anchor" id="41" href="sets.html"><tt>sets</tt></a>, <a class="lpdoc-idx-anchor" id="42" href="sort.html"><tt>sort</tt></a>. <li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="43" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="44" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="45" href="condcomp_doc.html"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="46" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="47" href="ciaosearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>, <a class="lpdoc-idx-anchor" id="48" href="isomodes_doc.html"><tt>isomodes</tt></a>, <a class="lpdoc-idx-anchor" id="49" href="regtypes_doc.html"><tt>regtypes</tt></a>. </ul></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>