Prim

Basically, Prim algorithm shares the same idea with Djikstra algorithm. Obviously, its pseudocode nearly same. However, they solve problems with different approach.

  • Prim's algorithm takes the graph as argument, and returns a tree:

    • Prim :: Graph --> Tree
  • Dijkstra's algorithm takes the graph and the starting node as arguments, and returns a function that gives shortest paths for each node:

    • Djikstra :: Graph --> Node --> ( Node --- Node)

Prim is like finding Minimum Spanning Tree.

Djikstra is like finding Shortest Path Tree.

results matching ""

    No results matching ""