**Problem Link**

**Author:** Sahil Rajput

**Tester:** Sahil Rajput

**Editorialist:** Sahil Rajput

**Difficulty**

Medium

**Prerequisites**

Graph Theory

**Problem**

Given a weighted graph with N nodes and starting position , you have to find the overall weight of MST of the graph taking 1 unit as Pi. Task is simple just implement Kruskal’s algorithm in the graph but if their are edges of equal weight first pick up the one with least value of given expression while sorting the edges initially.

**Time Complexity**

O(ELogV)

**Solution Link**