Reverse Delete Algorithm for Minimum Spanning Tree
Medium Accuracy: 32.34% Submissions: 796 Points: 4
Reverse Delete algorithm is closely related to Kruskal’s algorithm. In Reverse Delete algorithm, we sort all edges in decreasing order of their weights. After sorting, we one by one pick edges in decreasing order. We include current picked edge if excluding current edge causes disconnection in current graph. The main idea is delete edge if its deletion does not lead to disconnection of graph. Your task is to print the value of total weight of Minimum Spanning Tree formed.
The first line of the input contains an integer 'T' denoting the number of test cases. Then 'T' test cases follow. Each test case consists of two lines.
Description of test cases is as follows:
The First line of each test case contains two integers 'V' and 'E' which denotes the no of vertices and no of edges respectively.
The Second line of each test case contains 'E' space separated triplets of m , n and w denoting that there is an edge from m to n and their weights.