title: Implement decreaseKey in STL Priority Queue C++
body: <p>I'm trying to implement Prim's Algorithm and for that I need to have a decreaseKey method for a priority queue (to update the key value in a priority queue). Can I implement this in the STL Priority Queue?</p>
  
  <p>If it helps, this is the algorithm I'm following:</p>
  
  <ul>
  <li>for each vertex u in graph G
  <ul>
  <li>set key of u to INFINITY</li>
  <li>set parent of u to NIL</li>
  </ul></li>
  <li>set key of source vertex to 0</li>
  <li>en-queue to priority queue Q all vertices in graph with keys as above</li>
  <li>while Q is not empty
  <ul>
  <li>pop vertex u with lowest key in Q</li>
  <li>for each adjacent vertex v of u do
  <ul>
  <li>if (v is still in Q) and (key(u) + weight-function(u, v) &lt; key(v)) then
  <ul>
  <li>set u to be parent of v</li>
  <li>update v's key to equal key(u) + weight-function(u, v)  <em>// This part is giving me problems as I don't know how implement decreaseKey in priority queue</em></li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul>