Challenge: Find the Minimum Spanning Tree

Given an undirected weighted graph, find its minimum spanning tree.

Problem statement

Implement a function that returns the minimum spanning tree of the given graph.

Input

The input is an undirected weighted graph.

Output

The output is a possible minimum spanning tree.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.