Question of graph data structure. Skip if you can not answer. Do not reject . Answer in c++ and answer correct only else I will downvote. Transcribed Image Text: the people living in our imaginary worla
There are N cities in world numbered from 1 to N.
Due to a storm, every road in world was destroyed and now no libraries are left.
There are 2 types of operations :
You can construct a library by giving away A dollars in ith city.
You can repair an already existing road by giving away B dollars.
Your goal is to make libraries such that people of every city have access to some library.
People of the ith city can visit the library only if :
A library exists in that city.
There is a path from that city to a city which contains a library. ( the path should consist of repaired roads only )
You have to minimize the total cost such that people in every city can go to a library and output this minimum cost.
NOTE : You can only repair the roads which existed and not build on your own.
The first line consists of number of test cases T. Each test case consists of 4 integers N,M,A, B. which denote number of cities,
number of roads which existed , cost to build a library , cost to repair a road.
Next M lines contains M pairs denoted by U V which indicates a road existed between U and V.
1 <= T <= 10. 1 <= N <= 100000. O <= M <= 100000. 1 <= A,B <= 1000000000. 1 <= U,V < = N. Each road connects 2 distinct cities. Output Format Total minimum cost in dollars.