/usr/share/doc/python-pebl/html/network.html is in python-pebl-doc 1.0.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>network – Directed Acyclic Graphs — Pebl v1.0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '1.0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Pebl v1.0.1 documentation" href="index.html" />
<link rel="up" title="API Reference" href="apiref.html" />
<link rel="next" title="posterior – Posterior distribution" href="posterior.html" />
<link rel="prev" title="learner.simanneal – Simulated annealing learner" href="learner/simanneal.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="posterior.html" title="posterior – Posterior distribution"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="learner/simanneal.html" title="learner.simanneal – Simulated annealing learner"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Pebl v1.0.1 documentation</a> »</li>
<li><a href="apiref.html" accesskey="U">API Reference</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-pebl.network">
<span id="network-directed-acyclic-graphs"></span><h1><tt class="xref py py-mod docutils literal"><span class="pre">network</span></tt> – Directed Acyclic Graphs<a class="headerlink" href="#module-pebl.network" title="Permalink to this headline">¶</a></h1>
<p>A pebl network is a collection of nodes and directed edges between nodes.</p>
<p>Nodes are a list of pebl.data.Variable instances.
Edges are stored in EdgeList instances. This module provides two implementations,
MatrixEdgeList for small networks and SparseEdgeList for large, sparse
networks. Both offer the same functionality with different performance
characteristics.</p>
<p>Functions and methods accept and return nodes as numbers representing their
indices and edges as tuples of integers corresponding to (srcnode, destnode).</p>
<div class="section" id="edges">
<h2>Edges<a class="headerlink" href="#edges" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="pebl.network.EdgeSet">
<em class="property">class </em><tt class="descclassname">pebl.network.</tt><tt class="descname">EdgeSet</tt><big>(</big><em>num_nodes=0</em><big>)</big><a class="headerlink" href="#pebl.network.EdgeSet" title="Permalink to this definition">¶</a></dt>
<dd><p>Maintains a set of edges.</p>
<dl class="docutils">
<dt>Performance characteristics:</dt>
<dd><ul class="first last simple">
<li>Edge insertion: O(1)</li>
<li>Edge retrieval: O(n)</li>
</ul>
</dd>
</dl>
<p>Uses adjacency lists but exposes an adjacency matrix interface via the
adjacency_matrix property.</p>
<dl class="method">
<dt id="pebl.network.EdgeSet.add">
<tt class="descname">add</tt><big>(</big><em>edge</em><big>)</big><a class="headerlink" href="#pebl.network.EdgeSet.add" title="Permalink to this definition">¶</a></dt>
<dd><p>Add an edge to the list.</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.EdgeSet.add_many">
<tt class="descname">add_many</tt><big>(</big><em>edges</em><big>)</big><a class="headerlink" href="#pebl.network.EdgeSet.add_many" title="Permalink to this definition">¶</a></dt>
<dd><p>Add multiple edges.</p>
</dd></dl>
<dl class="attribute">
<dt id="pebl.network.EdgeSet.adjacency_lists">
<tt class="descname">adjacency_lists</tt><a class="headerlink" href="#pebl.network.EdgeSet.adjacency_lists" title="Permalink to this definition">¶</a></dt>
<dd><p>Set or get edges as two adjacency lists.</p>
<p>Property returns/accepts two adjacency lists for outgoing and incoming
edges respectively. Each adjacency list if a list of sets.</p>
</dd></dl>
<dl class="attribute">
<dt id="pebl.network.EdgeSet.adjacency_matrix">
<tt class="descname">adjacency_matrix</tt><a class="headerlink" href="#pebl.network.EdgeSet.adjacency_matrix" title="Permalink to this definition">¶</a></dt>
<dd><p>Set or get edges as an adjacency matrix.</p>
<p>The adjacency matrix is a boolean numpy.ndarray instance.</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.EdgeSet.children">
<tt class="descname">children</tt><big>(</big><em>node</em><big>)</big><a class="headerlink" href="#pebl.network.EdgeSet.children" title="Permalink to this definition">¶</a></dt>
<dd><p>Return list of nodes (as node indices) that have an edge from given node.</p>
<p>The returned list is sorted.
Method is also aliased as children().</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.EdgeSet.clear">
<tt class="descname">clear</tt><big>(</big><big>)</big><a class="headerlink" href="#pebl.network.EdgeSet.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>Clear the list of edges.</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.EdgeSet.incoming">
<tt class="descname">incoming</tt><big>(</big><em>node</em><big>)</big><a class="headerlink" href="#pebl.network.EdgeSet.incoming" title="Permalink to this definition">¶</a></dt>
<dd><p>Return list of nodes (as node indices) that have an edge to given node.</p>
<p>The returned list is sorted.
Method is also aliased as parents().</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.EdgeSet.outgoing">
<tt class="descname">outgoing</tt><big>(</big><em>node</em><big>)</big><a class="headerlink" href="#pebl.network.EdgeSet.outgoing" title="Permalink to this definition">¶</a></dt>
<dd><p>Return list of nodes (as node indices) that have an edge from given node.</p>
<p>The returned list is sorted.
Method is also aliased as children().</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.EdgeSet.parents">
<tt class="descname">parents</tt><big>(</big><em>node</em><big>)</big><a class="headerlink" href="#pebl.network.EdgeSet.parents" title="Permalink to this definition">¶</a></dt>
<dd><p>Return list of nodes (as node indices) that have an edge to given node.</p>
<p>The returned list is sorted.
Method is also aliased as parents().</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.EdgeSet.remove">
<tt class="descname">remove</tt><big>(</big><em>edge</em><big>)</big><a class="headerlink" href="#pebl.network.EdgeSet.remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove edges from edgelist.</p>
<p>If an edge to be removed does not exist, fail silently (no exceptions).</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.EdgeSet.remove_many">
<tt class="descname">remove_many</tt><big>(</big><em>edges</em><big>)</big><a class="headerlink" href="#pebl.network.EdgeSet.remove_many" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove multiple edges.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="network">
<h2>Network<a class="headerlink" href="#network" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="pebl.network.Network">
<em class="property">class </em><tt class="descclassname">pebl.network.</tt><tt class="descname">Network</tt><big>(</big><em>nodes</em>, <em>edges=None</em><big>)</big><a class="headerlink" href="#pebl.network.Network" title="Permalink to this definition">¶</a></dt>
<dd><p>A network is a set of nodes and directed edges between nodes</p>
<p>Creates a Network.</p>
<p>nodes is a list of pebl.data.Variable instances.
edges can be:</p>
<blockquote>
<div><ul class="simple">
<li>an EdgeSet instance</li>
<li>a list of edge tuples</li>
<li>an adjacency matrix (as boolean numpy.ndarray instance)</li>
<li>string representation (see Network.as_string() for format)</li>
</ul>
</div></blockquote>
<dl class="method">
<dt id="pebl.network.Network.as_dotfile">
<tt class="descname">as_dotfile</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#pebl.network.Network.as_dotfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Saves network as a dot file.</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.Network.as_dotstring">
<tt class="descname">as_dotstring</tt><big>(</big><big>)</big><a class="headerlink" href="#pebl.network.Network.as_dotstring" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns network as a dot-formatted string</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.Network.as_image">
<tt class="descname">as_image</tt><big>(</big><em>filename</em>, <em>decorator=<function <lambda> at 0x2e24a28></em>, <em>prog='dot'</em><big>)</big><a class="headerlink" href="#pebl.network.Network.as_image" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates an image (PNG format) for the newtork.</p>
<p>decorator is a function that accepts a pydot graph, modifies it and
returns it. decorators can be used to set visual appearance of
networks (color, style, etc).</p>
<p>prog is the Graphviz program to use (default: dot).</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.Network.as_pydot">
<tt class="descname">as_pydot</tt><big>(</big><big>)</big><a class="headerlink" href="#pebl.network.Network.as_pydot" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a pydot instance for the network.</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.Network.as_string">
<tt class="descname">as_string</tt><big>(</big><big>)</big><a class="headerlink" href="#pebl.network.Network.as_string" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the sparse string representation of network.</p>
<p>If network has edges (2,3) and (1,2), the sparse string representation
is “2,3;1,2”.</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.Network.copy">
<tt class="descname">copy</tt><big>(</big><big>)</big><a class="headerlink" href="#pebl.network.Network.copy" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a copy of this network.</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.Network.is_acyclic">
<tt class="descname">is_acyclic</tt><big>(</big><em>roots=None</em><big>)</big><a class="headerlink" href="#pebl.network.Network.is_acyclic" title="Permalink to this definition">¶</a></dt>
<dd><p>Uses a depth-first search (dfs) to detect cycles.</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.Network.is_acyclic_python">
<tt class="descname">is_acyclic_python</tt><big>(</big><em>roots=None</em><big>)</big><a class="headerlink" href="#pebl.network.Network.is_acyclic_python" title="Permalink to this definition">¶</a></dt>
<dd><p>Uses a depth-first search (dfs) to detect cycles.</p>
</dd></dl>
<dl class="method">
<dt id="pebl.network.Network.layout">
<tt class="descname">layout</tt><big>(</big><em>width=400</em>, <em>height=400</em>, <em>dotpath='dot'</em><big>)</big><a class="headerlink" href="#pebl.network.Network.layout" title="Permalink to this definition">¶</a></dt>
<dd><p>Determines network layout using Graphviz’s dot algorithm.</p>
<p>width and height are in pixels.
dotpath is the path to the dot application.</p>
<p>The resulting node positions are saved in network.node_positions.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="factory-functions">
<h2>Factory functions<a class="headerlink" href="#factory-functions" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="pebl.network.fromdata">
<tt class="descclassname">pebl.network.</tt><tt class="descname">fromdata</tt><big>(</big><em>data_</em><big>)</big><a class="headerlink" href="#pebl.network.fromdata" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a network from the variables in the dataset.</p>
</dd></dl>
<dl class="function">
<dt id="pebl.network.random_network">
<tt class="descclassname">pebl.network.</tt><tt class="descname">random_network</tt><big>(</big><em>nodes</em>, <em>required_edges=</em><span class="optional">[</span><span class="optional">]</span>, <em>prohibited_edges=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#pebl.network.random_network" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a random network with the given set of nodes.</p>
<p>Can specify required_edges and prohibited_edges to control the resulting
random network.</p>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><tt class="docutils literal"><span class="pre">network</span></tt> – Directed Acyclic Graphs</a><ul>
<li><a class="reference internal" href="#edges">Edges</a></li>
<li><a class="reference internal" href="#network">Network</a></li>
<li><a class="reference internal" href="#factory-functions">Factory functions</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="learner/simanneal.html"
title="previous chapter"><tt class="docutils literal docutils literal docutils literal"><span class="pre">learner.simanneal</span></tt> – Simulated annealing learner</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="posterior.html"
title="next chapter"><tt class="docutils literal"><span class="pre">posterior</span></tt> – Posterior distribution</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/network.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="posterior.html" title="posterior – Posterior distribution"
>next</a> |</li>
<li class="right" >
<a href="learner/simanneal.html" title="learner.simanneal – Simulated annealing learner"
>previous</a> |</li>
<li><a href="index.html">Pebl v1.0.1 documentation</a> »</li>
<li><a href="apiref.html" >API Reference</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2008, Abhik Shah.
Last updated on Apr 29, 2011.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
</div>
</body>
</html>
|