Find solution

What's the difference between prim and dijkstra's algorithm?

Check our answers to ‘What's the difference between prim and dijkstra's algorithm?’ - we found 30 replies and comments relevant to this matter. The best answers are submitted by users of Stack Overflow, and Yahoo! Answers.

Best solution

  • Difference between Prim and Dijkstra graph algorithm

    I'm reading graph algorithms from Cormen book. Below is pseudocode from that book Prim algorithm for MST MST-PRIM (G, w, r) for each u in G.V u.key = infinity u.p = NIL r.key = 0 Q = G.V while Q neq null u = EXTRACT-MIN(Q) for each v in G.Adj[u] if (v in Q) and (w(u,v) < v.key) v.p = u v.key = w(u,v) Dijkstra algorithm to find single source shortest path. INITIALIZE-SINGLE-SOURCE (G,s) for each vertex v in G.V v.d = infinity v.par = NIL s.d = 0 DIJKSTRA (G, w, s) INITIALIZE-SINGLE-SOURCE...


    The algorithms called Prim and Dijkstra solve different problems in the first place. 'Prim' finds a...

    Mark as irrelevant Undo

Other solutions