minimum-spanning-tree:

Repair Broken Edges of a Graph

There’s an undirected connected graph with n nodes labeled 1..n. But some of the edges has been broken disconnecting the graph. Find the minimum cost to repair the edges so that all the nodes are once again accessible from each other. Input n, an int representing the total number of nodes. edges, a list of integer pair representing the nodes connected by an edge. edgesToRepair, a list where each element is a triplet representing the pair of nodes between which an edge is currently broken and the cost of repearing that edge respectively (e.

by lek tin in "algorithm" access_time 4-min read