<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.programmingexamples.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FBoost%2FBGL%2FIndirectPriorityQueue</id>
		<title>CPP/Boost/BGL/IndirectPriorityQueue - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FBoost%2FBGL%2FIndirectPriorityQueue"/>
		<link rel="alternate" type="text/html" href="http://www.programmingexamples.net/w/index.php?title=CPP/Boost/BGL/IndirectPriorityQueue&amp;action=history"/>
		<updated>2026-08-03T19:06:58Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.5</generator>

	<entry>
		<id>http://www.programmingexamples.net/w/index.php?title=CPP/Boost/BGL/IndirectPriorityQueue&amp;diff=5181&amp;oldid=prev</id>
		<title>Daviddoria at 14:51, 3 September 2012</title>
		<link rel="alternate" type="text/html" href="http://www.programmingexamples.net/w/index.php?title=CPP/Boost/BGL/IndirectPriorityQueue&amp;diff=5181&amp;oldid=prev"/>
				<updated>2012-09-03T14:51:20Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;http://www.programmingexamples.net/w/index.php?title=CPP/Boost/BGL/IndirectPriorityQueue&amp;amp;diff=5181&amp;amp;oldid=5180&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	<entry>
		<id>http://www.programmingexamples.net/w/index.php?title=CPP/Boost/BGL/IndirectPriorityQueue&amp;diff=5180&amp;oldid=prev</id>
		<title>Daviddoria: Created page with '==IndirectPriorityQueue.cpp== &lt;source lang=&quot;cpp&quot;&gt; #include &lt;iostream&gt; #include &lt;iomanip&gt;  #include &lt;boost/graph/grid_graph.hpp&gt; #include &lt;boost/graph/detail/d_ary_heap.hpp&gt; #incl…'</title>
		<link rel="alternate" type="text/html" href="http://www.programmingexamples.net/w/index.php?title=CPP/Boost/BGL/IndirectPriorityQueue&amp;diff=5180&amp;oldid=prev"/>
				<updated>2012-09-03T14:42:45Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;==IndirectPriorityQueue.cpp== &amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt; #include &amp;lt;iostream&amp;gt; #include &amp;lt;iomanip&amp;gt;  #include &amp;lt;boost/graph/grid_graph.hpp&amp;gt; #include &amp;lt;boost/graph/detail/d_ary_heap.hpp&amp;gt; #incl…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==IndirectPriorityQueue.cpp==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;iomanip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;boost/graph/grid_graph.hpp&amp;gt;&lt;br /&gt;
#include &amp;lt;boost/graph/detail/d_ary_heap.hpp&amp;gt;&lt;br /&gt;
#include &amp;lt;boost/property_map/property_map.hpp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main(int, char*[])&lt;br /&gt;
{&lt;br /&gt;
  srand((unsigned int)time(NULL));&lt;br /&gt;
&lt;br /&gt;
  boost::array&amp;lt;std::size_t, 2&amp;gt; lengths = { { 5,5 } };&lt;br /&gt;
  typedef boost::grid_graph&amp;lt;2&amp;gt; GraphType;&lt;br /&gt;
  GraphType graph(lengths);&lt;br /&gt;
  typedef boost::graph_traits&amp;lt;GraphType&amp;gt;::vertex_descriptor Vertex;&lt;br /&gt;
  typedef boost::property_map&amp;lt;GraphType, boost::vertex_index_t&amp;gt;::const_type GridIndexMapType;&lt;br /&gt;
  GridIndexMapType gridIndexMap(get(boost::vertex_index, graph));&lt;br /&gt;
&lt;br /&gt;
  typedef boost::vector_property_map&amp;lt;std::size_t, GridIndexMapType&amp;gt; IndexInHeapMap;&lt;br /&gt;
  IndexInHeapMap index_in_heap(gridIndexMap);&lt;br /&gt;
&lt;br /&gt;
  typedef boost::graph_traits&amp;lt;GraphType&amp;gt;::vertex_iterator VertexIteratorType;&lt;br /&gt;
&lt;br /&gt;
  typedef boost::vector_property_map&amp;lt;float, GridIndexMapType&amp;gt; PriorityMapType;&lt;br /&gt;
  PriorityMapType priorityMap(gridIndexMap);&lt;br /&gt;
  VertexIteratorType vertexIterator, vertexIteratorEnd;&lt;br /&gt;
&lt;br /&gt;
  typedef std::greater&amp;lt;float&amp;gt; ComparisonFunctor;&lt;br /&gt;
  typedef boost::d_ary_heap_indirect&amp;lt;Vertex, 4, IndexInHeapMap, PriorityMapType, ComparisonFunctor &amp;gt; MutableQueue;&lt;br /&gt;
&lt;br /&gt;
  ComparisonFunctor comparisonFunctor;&lt;br /&gt;
  MutableQueue mutableQueue(priorityMap, index_in_heap, comparisonFunctor);&lt;br /&gt;
&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;There are &amp;quot; &amp;lt;&amp;lt; mutableQueue.size() &amp;lt;&amp;lt; &amp;quot; items in the queue.&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
  // Add random values to the vertices and add them to the queue&lt;br /&gt;
  for( tie(vertexIterator, vertexIteratorEnd) = vertices(graph); vertexIterator != vertexIteratorEnd; ++vertexIterator)&lt;br /&gt;
  {&lt;br /&gt;
    put(priorityMap, *vertexIterator, rand() % 1000);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  for( tie(vertexIterator, vertexIteratorEnd) = vertices(graph); vertexIterator != vertexIteratorEnd; ++vertexIterator)&lt;br /&gt;
  {&lt;br /&gt;
    mutableQueue.push(*vertexIterator);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;There are &amp;quot; &amp;lt;&amp;lt; mutableQueue.size() &amp;lt;&amp;lt; &amp;quot; items in the queue.&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
  // Insert another set of random values for each vertex&lt;br /&gt;
  for( tie(vertexIterator, vertexIteratorEnd) = vertices(graph); vertexIterator != vertexIteratorEnd; ++vertexIterator)&lt;br /&gt;
  {&lt;br /&gt;
    put(priorityMap, *vertexIterator, rand() % 1000);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  for( tie(vertexIterator, vertexIteratorEnd) = vertices(graph); vertexIterator != vertexIteratorEnd; ++vertexIterator)&lt;br /&gt;
  {&lt;br /&gt;
    mutableQueue.push(*vertexIterator);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;There are &amp;quot; &amp;lt;&amp;lt; mutableQueue.size() &amp;lt;&amp;lt; &amp;quot; items in the queue.&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;The priority queue is: &amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  while( ! mutableQueue.empty() )&lt;br /&gt;
  {&lt;br /&gt;
    Vertex u = mutableQueue.top();&lt;br /&gt;
&lt;br /&gt;
    // These two lines are equivalent&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;vertex: &amp;quot; &amp;lt;&amp;lt; u[0] &amp;lt;&amp;lt; &amp;quot; &amp;quot; &amp;lt;&amp;lt; u[1] &amp;lt;&amp;lt; &amp;quot; priority: &amp;quot; &amp;lt;&amp;lt; get(priorityMap, u) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
    mutableQueue.pop();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Output:&lt;br /&gt;
There are 0 items in the queue.&lt;br /&gt;
There are 25 items in the queue.&lt;br /&gt;
There are 50 items in the queue.&lt;br /&gt;
The priority queue is: &lt;br /&gt;
vertex: 2 4 priority: 967&lt;br /&gt;
vertex: 0 0 priority: 945&lt;br /&gt;
vertex: 0 0 priority: 945&lt;br /&gt;
vertex: 1 3 priority: 922&lt;br /&gt;
vertex: 0 2 priority: 907&lt;br /&gt;
vertex: 4 4 priority: 901&lt;br /&gt;
vertex: 2 4 priority: 967&lt;br /&gt;
vertex: 4 4 priority: 901&lt;br /&gt;
vertex: 0 1 priority: 858&lt;br /&gt;
vertex: 0 2 priority: 907&lt;br /&gt;
vertex: 0 1 priority: 858&lt;br /&gt;
vertex: 3 4 priority: 852&lt;br /&gt;
vertex: 3 4 priority: 852&lt;br /&gt;
vertex: 2 2 priority: 793&lt;br /&gt;
vertex: 2 2 priority: 793&lt;br /&gt;
vertex: 1 3 priority: 922&lt;br /&gt;
vertex: 1 1 priority: 791&lt;br /&gt;
vertex: 1 1 priority: 791&lt;br /&gt;
vertex: 4 2 priority: 781&lt;br /&gt;
vertex: 4 2 priority: 781&lt;br /&gt;
vertex: 1 2 priority: 748&lt;br /&gt;
vertex: 1 2 priority: 748&lt;br /&gt;
vertex: 2 3 priority: 734&lt;br /&gt;
vertex: 4 3 priority: 661&lt;br /&gt;
vertex: 4 3 priority: 661&lt;br /&gt;
vertex: 2 3 priority: 734&lt;br /&gt;
vertex: 3 3 priority: 652&lt;br /&gt;
vertex: 3 3 priority: 652&lt;br /&gt;
vertex: 3 2 priority: 529&lt;br /&gt;
vertex: 3 2 priority: 529&lt;br /&gt;
vertex: 3 0 priority: 493&lt;br /&gt;
vertex: 3 0 priority: 493&lt;br /&gt;
vertex: 2 0 priority: 488&lt;br /&gt;
vertex: 2 0 priority: 488&lt;br /&gt;
vertex: 4 1 priority: 450&lt;br /&gt;
vertex: 4 1 priority: 450&lt;br /&gt;
vertex: 4 0 priority: 346&lt;br /&gt;
vertex: 4 0 priority: 346&lt;br /&gt;
vertex: 0 3 priority: 328&lt;br /&gt;
vertex: 0 3 priority: 328&lt;br /&gt;
vertex: 1 4 priority: 245&lt;br /&gt;
vertex: 1 4 priority: 245&lt;br /&gt;
vertex: 1 0 priority: 216&lt;br /&gt;
vertex: 1 0 priority: 216&lt;br /&gt;
vertex: 0 4 priority: 64&lt;br /&gt;
vertex: 0 4 priority: 64&lt;br /&gt;
vertex: 2 1 priority: 47&lt;br /&gt;
vertex: 2 1 priority: 47&lt;br /&gt;
vertex: 3 1 priority: 14&lt;br /&gt;
vertex: 3 1 priority: 14&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CMakeLists.txt==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
cmake_minimum_required(VERSION 2.6)&lt;br /&gt;
&lt;br /&gt;
Project(IndirectPriorityQueue)&lt;br /&gt;
&lt;br /&gt;
set(Boost_USE_MULTITHREADED ON)&lt;br /&gt;
FIND_PACKAGE(Boost 1.38 COMPONENTS)&lt;br /&gt;
&lt;br /&gt;
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${Boost_INCLUDE_DIRS})&lt;br /&gt;
LINK_DIRECTORIES(${LINK_DIRECTORIES} ${Boost_LIBRARY_DIRS})&lt;br /&gt;
&lt;br /&gt;
ADD_EXECUTABLE(IndirectPriorityQueue IndirectPriorityQueue.cpp)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	</feed>