A utility function to print the constructed MST stored in parent [ ] and print Minimum Obtaiable product
def printMST ( parent , n , graph ) : NEW_LINE INDENT print ( " Edge ▁ Weight " ) NEW_LINE minProduct = 1 NEW_LINE for i in range ( 1 , V ) : NEW_LINE INDENT print ( " { } ▁ - ▁ { } ▁ { } ▁ " . format ( parent [ i ] , i , graph [ i ] [ parent [ i ] ] ) ) NEW_LINE minProduct *= graph [ i ] [ parent [ i ] ] NEW_LINE DEDENT print ( " Minimum ▁ Obtainable ▁ product ▁ is ▁ { } " . format ( minProduct ) ) NEW_LINE DEDENT