<h1class="title">Intel® Threading Building Blocks.<br>Shortpath sample</h1>
</div>
<p>
This directory contains a simple example that solves the single source
shortest path problem.
<br><br>
It is parameterized by N, a number of nodes, and a start and end node in [0..N).
A graph is generated with N nodes and some random number of connections between those nodes.
A parallel algorithm based on A* is used to find the shortest path.
<br><br>
This algorithm varies from serial A* in that it needs to add nodes back to
the open set when the g estimate (shortest path from start to the node) is improved,
even if the node has already been "visited". This is because nodes are added and removed
from the open-set in parallel, resulting in some less optimal paths being explored.
The open-set is implemented with the concurrent_priority_queue.
<br><br>
Note that since we re-visit nodes, the <i>f</i> estimate (on which the priority queue is sorted)
is not technically needed, so we could use this same parallel algorithm with just a concurrent_queue.
However, keeping the <i>f</i> estimate and using <code>concurrent_priority_queue</code>
results in much better performance.
<br><br>
Silent mode prints run time only,
regular mode prints the shortest path length,
and verbose mode prints out the shortest path.
<br><br>
The generated graph follows a pattern in which the closer two pairs of
node ids are together, the fewer hops there are in a typical path
between those nodes. So, for example, the path between 5 and 7 likely
has few hops whereas 14 to 78 has more and 0 to 9999 has even more,
etc.
</p>
<divclass="changes">
<divclass="h3-alike">System Requirements</div>
<inputtype="checkbox">
<divclass="show-hide">
<p>
For the most up to date system requirements, see the <ahref="http://software.intel.com/en-us/articles/intel-threading-building-blocks-release-notes">release notes.</a>
</p>
</div>
</div>
<divclass="changes">
<divclass="h3-alike">Files</div>
<inputtype="checkbox"checked="checked">
<divclass="show-hide">
<dl>
<dt><ahref="shortpath.cpp">shortpath.cpp</a>
<dd>Driver.
<dt><ahref="Makefile">Makefile</a>
<dd>Makefile for building the example.
</dl>
</div>
</div>
<divclass="changes">
<divclass="h3-alike">Directories</div>
<inputtype="checkbox"checked="checked">
<divclass="show-hide">
<dl>
<dt><ahref="msvs/">msvs</a>
<dd>Contains Microsoft* Visual Studio* workspace for building and running the example with the Intel® C++ Compiler (Windows* systems only).
<p>For information about the minimum supported version of IDE, see <ahref="http://software.intel.com/en-us/articles/intel-threading-building-blocks-release-notes">release notes.</a></p>
</div>
</div>
<divclass="changes">
<divclass="h3-alike">Build instructions</div>
<inputtype="checkbox"checked="checked">
<divclass="show-hide">
<p>General build directions can be found <ahref="../../index.html">here</a>.</p>
<dd><tt><i>#threads</i></tt> is the number of threads to use; a range of the form <tt><i>low[:high]</i></tt> where <tt><i>low</i></tt> and optional <tt><i>high</i></tt> are non-negative integers, or <tt><i>'auto'</i></tt> for the TBB default.<br>
<tt><i>verbose</i></tt> print full path to screen<br>
<tt><i>silent</i></tt> limits output to timing info; overrides verbose<br>
<tt><i>N</i></tt> number of nodes in graph<br>
<tt><i>start</i></tt> node to start path at<br>
<tt><i>end</i></tt> node to end path at<br>
<dt>To run a short version of this example, e.g., for use with Intel® Parallel Inspector:
<dd>Build a <i>debug</i> version of the example
(see the <ahref="../../index.html">build instructions</a>).
<br>Run it with a small problem size and the desired number of threads, e.g., <tt>shortpath 4 N=20 start=0 end=19</tt>.
</dl>
</div>
</div>
<br>
<ahref="../index.html">Up to parent directory</a>
<hr>
<divclass="changes">
<divclass="h3-alike">Legal Information</div>
<inputtype="checkbox">
<divclass="show-hide">
<p>
Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries.
<br>* Other names and brands may be claimed as the property of others.