A utility function to print the constructed MST stored in parent [ ] and print Minimum Obtaiable product
static void printMST ( int parent [ ] , int n , int graph [ ] [ ] ) { System . out . printf ( "Edge WeightNEW_LINE"); int minProduct = 1 ; for ( int i = 1 ; i < V ; i ++ ) { System . out . printf ( "%d - %d %d NEW_LINE", parent[i], i, graph[i][parent[i]]); minProduct *= graph [ i ] [ parent [ i ] ] ; } System . out . printf ( "Minimum Obtainable product is %dNEW_LINE", minProduct); }