summaryrefslogtreecommitdiffstats
path: root/python/altgraph/doc/_build/html/objectgraph.html
blob: c9879f65642f7abc15988b0316a6f5875869bde3 (plain)
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
<!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>altgraph.ObjectGraph — Graphs of objecs with an identifier &mdash; altgraph 0.11 documentation</title>
    
    <link rel="stylesheet" href="_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '0.11',
        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="altgraph 0.11 documentation" href="index.html" />
    <link rel="next" title="altgraph.GraphAlgo — Graph algorithms" href="graphalgo.html" />
    <link rel="prev" title="altgraph.Graph — Basic directional graphs" href="graph.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="graphalgo.html" title="altgraph.GraphAlgo — Graph algorithms"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="graph.html" title="altgraph.Graph — Basic directional graphs"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">altgraph 0.11 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-altgraph.ObjectGraph">
<span id="altgraph-objectgraph-graphs-of-objecs-with-an-identifier"></span><h1><a class="reference internal" href="#module-altgraph.ObjectGraph" title="altgraph.ObjectGraph: A graph of objects that have a &quot;graphident&quot; attribute."><tt class="xref py py-mod docutils literal"><span class="pre">altgraph.ObjectGraph</span></tt></a> &#8212; Graphs of objecs with an identifier<a class="headerlink" href="#module-altgraph.ObjectGraph" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="altgraph.ObjectGraph.ObjectGraph">
<em class="property">class </em><tt class="descclassname">altgraph.ObjectGraph.</tt><tt class="descname">ObjectGraph</tt><big>(</big><span class="optional">[</span><em>graph</em><span class="optional">[</span>, <em>debug</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph" title="Permalink to this definition">¶</a></dt>
<dd><p>A graph of objects that have a &#8220;graphident&#8221; attribute. The
value of this attribute is the key for the object in the
graph.</p>
<p>The optional <em>graph</em> is a previously constructed
<a class="reference internal" href="graph.html#altgraph.Graph.Graph" title="altgraph.Graph.Graph"><tt class="xref py py-class docutils literal"><span class="pre">Graph</span></tt></a>.</p>
<p>The optional <em>debug</em> level controls the amount of debug output
(see <a class="reference internal" href="#altgraph.ObjectGraph.ObjectGraph.msg" title="altgraph.ObjectGraph.ObjectGraph.msg"><tt class="xref py py-meth docutils literal"><span class="pre">msg()</span></tt></a>, <a class="reference internal" href="#altgraph.ObjectGraph.ObjectGraph.msgin" title="altgraph.ObjectGraph.ObjectGraph.msgin"><tt class="xref py py-meth docutils literal"><span class="pre">msgin()</span></tt></a> and <a class="reference internal" href="#altgraph.ObjectGraph.ObjectGraph.msgout" title="altgraph.ObjectGraph.ObjectGraph.msgout"><tt class="xref py py-meth docutils literal"><span class="pre">msgout()</span></tt></a>).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">the altgraph library does not generate output, the
debug attribute and message methods are present for use
by subclasses.</p>
</div>
</dd></dl>

<dl class="data">
<dt id="altgraph.ObjectGraph.ObjectGraph.graph">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">graph</tt><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.graph" title="Permalink to this definition">¶</a></dt>
<dd><p>An <a class="reference internal" href="graph.html#altgraph.Graph.Graph" title="altgraph.Graph.Graph"><tt class="xref py py-class docutils literal"><span class="pre">Graph</span></tt></a> object that contains
the graph data.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.addNode">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">addNode</tt><big>(</big><em>node</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.addNode" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds a <em>node</em> to the graph.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">re-adding a node that was previously removed
using <a class="reference internal" href="#altgraph.ObjectGraph.ObjectGraph.removeNode" title="altgraph.ObjectGraph.ObjectGraph.removeNode"><tt class="xref py py-meth docutils literal"><span class="pre">removeNode()</span></tt></a> will reinstate the previously
removed node.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.createNode">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">createNode</tt><big>(</big><em>self</em>, <em>cls</em>, <em>name</em>, <em>*args</em>, <em>**kwds</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.createNode" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a new node using <tt class="docutils literal"><span class="pre">cls(*args,</span> <span class="pre">**kwds)</span></tt> and adds that
node using <a class="reference internal" href="#altgraph.ObjectGraph.ObjectGraph.addNode" title="altgraph.ObjectGraph.ObjectGraph.addNode"><tt class="xref py py-meth docutils literal"><span class="pre">addNode()</span></tt></a>.</p>
<p>Returns the newly created node.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.removeNode">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">removeNode</tt><big>(</big><em>node</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.removeNode" title="Permalink to this definition">¶</a></dt>
<dd><p>Removes a <em>node</em> from the graph when it exists. The <em>node</em> argument
is either a node object, or the graphident of a node.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.createReferences">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">createReferences</tt><big>(</big><em>fromnode</em>, <em>tonode</em><span class="optional">[</span>, <em>edge_data</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.createReferences" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a reference from <em>fromnode</em> to <em>tonode</em>. The optional
<em>edge_data</em> is associated with the edge.</p>
<p><em>Fromnode</em> and <em>tonode</em> can either be node objects or the graphident
values for nodes.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.removeReference">
<tt class="descclassname">altgraph.ObjectGraph.</tt><tt class="descname">removeReference</tt><big>(</big><em>fromnode</em>, <em>tonode</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.removeReference" title="Permalink to this definition">¶</a></dt>
<dd><p>Removes the reference from <em>fromnode</em> to <em>tonode</em> if it exists.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.getRawIdent">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">getRawIdent</tt><big>(</big><em>node</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.getRawIdent" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the <em>graphident</em> attribute of <em>node</em>, or the graph itself
when <em>node</em> is <a class="reference external" href="http://docs.python.org/library/constants.html#None" title="(in Python v2.7)"><tt class="xref py py-data docutils literal"><span class="pre">None</span></tt></a>.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.getIdent">
<tt class="descclassname">altgraph.ObjectGraph.</tt><tt class="descname">getIdent</tt><big>(</big><em>node</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.getIdent" title="Permalink to this definition">¶</a></dt>
<dd><p>Same as <tt class="xref py py-meth docutils literal"><span class="pre">getRawIdent()</span></tt>, but only if the node is part
of the graph.</p>
<p><em>Node</em> can either be an actual node object or the graphident of
a node.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.findNode">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">findNode</tt><big>(</big><em>node</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.findNode" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a given node in the graph, or <tt class="xref py py-data docutils literal"><span class="pre">Node</span></tt> when it cannot
be found.</p>
<p><em>Node</em> is either an object with a <em>graphident</em> attribute or
the <em>graphident</em> attribute itself.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.__contains__">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">__contains__</tt><big>(</big><em>node</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.__contains__" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns True if <em>node</em> is a member of the graph. <em>Node</em> is either an
object with a <em>graphident</em> attribute or the <em>graphident</em> attribute itself.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.flatten">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">flatten</tt><big>(</big><span class="optional">[</span><em>condition</em><span class="optional">[</span>, <em>start</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.flatten" title="Permalink to this definition">¶</a></dt>
<dd><p>Yield all nodes that are entirely reachable by <em>condition</em>
starting fromt he given <em>start</em> node or the graph root.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">objects are only reachable from the graph root
when there is a reference from the root to the node
(either directly or through another node)</p>
</div>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.nodes">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">nodes</tt><big>(</big><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.nodes" title="Permalink to this definition">¶</a></dt>
<dd><p>Yield all nodes in the graph.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.get_edges">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">get_edges</tt><big>(</big><em>node</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.get_edges" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns two iterators that yield the nodes reaching by
outgoing and incoming edges.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.filterStack">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">filterStack</tt><big>(</big><em>filters</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.filterStack" title="Permalink to this definition">¶</a></dt>
<dd><p>Filter the ObjectGraph in-place by removing all edges to nodes that
do not match every filter in the given filter list</p>
<p>Returns a tuple containing the number of:
(<em>nodes_visited</em>, <em>nodes_removed</em>, <em>nodes_orphaned</em>)</p>
</dd></dl>

<div class="section" id="debug-output">
<h2>Debug output<a class="headerlink" href="#debug-output" title="Permalink to this headline">¶</a></h2>
<dl class="data">
<dt id="altgraph.ObjectGraph.ObjectGraph.debug">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">debug</tt><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.debug" title="Permalink to this definition">¶</a></dt>
<dd><p>The current debug level.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.msg">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">msg</tt><big>(</big><em>level</em>, <em>text</em>, <em>*args</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.msg" title="Permalink to this definition">¶</a></dt>
<dd><p>Print a debug message at the current indentation level when the current
debug level is <em>level</em> or less.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.msgin">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">msgin</tt><big>(</big><em>level</em>, <em>text</em>, <em>*args</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.msgin" title="Permalink to this definition">¶</a></dt>
<dd><p>Print a debug message when the current debug level is <em>level</em> or less,
and increase the indentation level.</p>
</dd></dl>

<dl class="method">
<dt id="altgraph.ObjectGraph.ObjectGraph.msgout">
<tt class="descclassname">ObjectGraph.</tt><tt class="descname">msgout</tt><big>(</big><em>level</em>, <em>text</em>, <em>*args</em><big>)</big><a class="headerlink" href="#altgraph.ObjectGraph.ObjectGraph.msgout" title="Permalink to this definition">¶</a></dt>
<dd><p>Decrease the indentation level and print a debug message when the
current debug level is <em>level</em> or less.</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">altgraph.ObjectGraph</span></tt> &#8212; Graphs of objecs with an identifier</a><ul>
<li><a class="reference internal" href="#debug-output">Debug output</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="graph.html"
                        title="previous chapter"><tt class="docutils literal"><span class="pre">altgraph.Graph</span></tt> &#8212; Basic directional graphs</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="graphalgo.html"
                        title="next chapter"><tt class="docutils literal"><span class="pre">altgraph.GraphAlgo</span></tt> &#8212; Graph algorithms</a></p>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <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="graphalgo.html" title="altgraph.GraphAlgo — Graph algorithms"
             >next</a> |</li>
        <li class="right" >
          <a href="graph.html" title="altgraph.Graph — Basic directional graphs"
             >previous</a> |</li>
        <li><a href="index.html">altgraph 0.11 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2010-2011, Ronald Oussoren, Bob Ippolito, 2004 Istvan Albert.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.1.
    </div>
  </body>
</html>