MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / kruskal

Function kruskal

src/graph/minimum_spanning_tree.rs:47–69  ·  view source on GitHub ↗

Executes Kruskal's algorithm to compute the Minimum Spanning Tree (MST) of a graph. # Parameters - `edges`: A vector of `Edge` instances representing all edges in the graph. - `num_vertices`: The total number of vertices in the graph. # Returns An `Option` containing a tuple with: - The total cost of the MST (usize). - A vector of edges that are included in the MST. Returns `None` if the gra

(mut edges: Vec<Edge>, num_vertices: usize)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls 3

mergeMethod · 0.80
pushMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected