MCPcopy Create free account
hub / github.com/djeada/Algorithms-And-Data-Structures / prim

Function prim

src/graphs/python/prim/src/prim.py:10–49  ·  view source on GitHub ↗

Find the minimum spanning tree weight using Prim's algorithm. Uses a priority queue (min-heap) for efficient O((V+E) log V) performance. Args: graph: The graph to find the MST for. Returns: The total weight of the minimum spanning tree.

(graph: Graph)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 2

Calls 2

verticesMethod · 0.45
edges_from_vertexMethod · 0.45

Tested by 2