revisedessays logo
  • Our services
    • Write My Essay
    • Term Paper Services
    • Research Paper Services
    • Business Plan and Case Study
    • Dissertation and Capstone project
    • Nursing Help Services
    • Online Coursework Help
    • Proofreading and Editing
    • Finance and Accounting Help
    • Programming Help Services
  • About Us
    • How it works
    • Who are we
    • FAQ
  • Pricing
  • Contact Us
  • My account
  • Order now
Order Now
computer-engineering

Question of graph data structure. Skip if you can not answer. Do not reject . Answer in c++ and answer correct only else I will

2 min read
Posted on 
April 3rd, 2022
Home computer-engineering Question of graph data structure. Skip if you can not answer. Do not reject . Answer in c++ and answer correct only else I will

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.
very
tudious.
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.
OR
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.
Input Format
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.
Constraints
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.

Order an Essay Now & Get These Features For Free:

Turnitin Report

Formatting

Title Page

Citation

Outline

Place an Order
Share
Tweet
Share
Tweet
Calculate the price
Pages (275 words)
$0.00
revisedessays
About Us
  • How it works
  • Who are we
  • FAQ
Location
High Falls Business Center 250 Mill Street Rochester, NY 14614
© 2023 revisedessays. All rights reserved.
revisedessays will be listed as ‘revisedessays’ on your bank statement.

WhatsApp us