Popular recipes tagged "graphs" but not "dot"http://code.activestate.com/recipes/tags/graphs-dot/2010-12-25T23:36:35-08:00ActiveState Code RecipesA-star Shortest Path Algorithm (C++)
2010-12-25T23:36:35-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577457-a-star-shortest-path-algorithm/
<p style="color: grey">
C++
recipe 577457
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/graph/">graph</a>, <a href="/recipes/tags/graphs/">graphs</a>, <a href="/recipes/tags/routes/">routes</a>).
Revision 4.
</p>
<p>A-star (A*) is a shortest path algorithm widely used for RTS games, GPS navigation etc.</p>
Create module dependency graph (Python)
2010-05-07T11:29:03-07:00Noufal Ibrahimhttp://code.activestate.com/recipes/users/4173873/http://code.activestate.com/recipes/577222-create-module-dependency-graph/
<p style="color: grey">
Python
recipe 577222
by <a href="/recipes/users/4173873/">Noufal Ibrahim</a>
(<a href="/recipes/tags/dependecies/">dependecies</a>, <a href="/recipes/tags/graphs/">graphs</a>, <a href="/recipes/tags/utilities/">utilities</a>).
</p>
<p>The following snippet will dump the module dependencies in a format that can be interpreted by the dot program distributed along with graphviz. You can use it like below to see the dependency graph for the asynchat module for example. (the program is saved as grapher.py)</p>
<pre class="prettyprint"><code>python grapher.py asynchat | dot -Tpng | display
</code></pre>
<p>A screenshot is available here <a href="http://twitpic.com/1lqnmh" rel="nofollow">http://twitpic.com/1lqnmh</a></p>
Depth first search generator (Python)
2009-11-09T04:46:21-08:00Paul W. Millerhttp://code.activestate.com/recipes/users/4172186/http://code.activestate.com/recipes/576946-depth-first-search-generator/
<p style="color: grey">
Python
recipe 576946
by <a href="/recipes/users/4172186/">Paul W. Miller</a>
(<a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/graphs/">graphs</a>).
Revision 7.
</p>
<p>This is the standard iterative DFS code modified to yield the vertices visited, so you don't have to pass a function into the DFS routine to process them. Note that this code is not quite complete... you'll need to define the function neighbors (v) based on your graph representation.</p>