title: Make priority queue from dictionary
body: <p>I have a dictionary where the key is the node and the value is another dictionary. This dictionary has as keys the parent of the node and the cost to reach that node. For example:</p>
  
  <pre><code>nodes = {0: {'cost': 0, 'parent': None}, 1: {'cost': 2, 'parent': 0}, 2: {'cost': 3, 'parent': 0}, 3: {'cost': 6, 'parent': 1}, 4: {'cost': 8, 'parent': 2}}
  </code></pre>
  
  <p>I want to extract each node in order of cost. First ones of less value. How could I do it?</p>