About 1,180,000 results
Open links in new tab
  1. Prim’s Algorithm for Minimum Spanning Tree (MST)

    Feb 26, 2025 · Follow the given steps to utilize the Prim’s Algorithm mentioned above for finding MST of a graph: Create a set mstSet that keeps track of vertices already included in MST. Assign a key value to all vertices in the input graph.

  2. Prim’s Algorithm in C - GeeksforGeeks

    Jun 27, 2024 · Prim’s algorithm is a greedy algorithm that finds the minimum spanning tree (MST) for a weighted undirected graph. It starts with a single vertex and grows the MST one edge at a time by adding the smallest edge that connects a vertex in the MST to a vertex outside the MST.

  3. Prim's Algorithm – Explained with a Pseudocode Example

    Feb 14, 2023 · In Computer Science, Prim’s algorithm helps you find the minimum spanning tree of a graph. It is a greedy algorithm – meaning it selects the option available at the moment. In this article, I’ll show you the pseudocode representation of Prim’s algori...

  4. Minimum Spanning Tree - Prim's Algorithm - Algorithms for …

    Apr 22, 2025 · Minimum spanning tree - Prim's algorithm¶ Given a weighted, undirected graph $G$ with $n$ vertices and $m$ edges. You want to find a spanning tree of this graph which connects all vertices and has the least weight (i.e. the sum of weights of edges is minimal).

  5. Prim's Algorithm - Programiz

    Prim's algorithm is a minimum spanning tree algorithm that takes a graph as input and finds the subset of the edges of that graph which. It falls under a class of algorithms called greedy algorithms that find the local optimum in the hopes of finding a global optimum.

  6. DSA Prim's Algorithm - W3Schools

    Prim's algorithm is greedy, and has a straightforward way to create a minimum spanning tree. For Prim's algorithm to work, all the nodes must be connected. To find the MST's in an unconnected graph, Kruskal's algorithm can be used instead.

  7. Prim's Algorithm for Minimum Spanning Tree: Detailed …

    Jan 10, 2025 · Prim’s Algorithm is a greedy algorithm used to find the MST of a graph. It starts from an arbitrary vertex and grows the tree by adding the smallest edge connecting the tree to a vertex outside the tree. The algorithm ensures that every step minimizes the …

  8. Prim‘s Algorithm - A Comprehensive Guide With Pseudocode …

    Sep 2, 2024 · Prim‘s algorithm effectively navigates the matroid polytope geometry exploiting greedy choice optimality. This lens explains why locally optimum edge selections achieve global MST minimum despite potential alternatives.

  9. Prim's Algorithm Explanation with Example - Quescol

    Mar 22, 2021 · Prim’s algorithm uses the greedy approach to find a minimum cost spanning tree for a connected weighted undirected graph. The algorithm builds a tree that includes all vertex and a subset of the edges in such a way that the sum of all the edges weight in …

  10. Prim’s Algorithm in C++ - GeeksforGeeks

    Sep 30, 2024 · In this article, we will learn the working of Prim's Algorithm, how to implement it in C++, and its applications. What is Prim's Algorithm for MST? Prim’s Algorithm finds the subset of the edges in a graph that connects all vertices with the minimum total edge weight.

  11. Some results have been removed
Refresh