Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

solve it in C++ DAS Part 2: Lab Tasks (10 points) Note: Copy this section into a new file then save it. You will only

solve it in C++
DAS
image text in transcribed
image text in transcribed
image text in transcribed
Part 2: Lab Tasks (10 points) Note: Copy this section into a new file then save it. You will only submit this section of the lab manual. Description: In a social networking site, people are connected with other people. The whole system appears as a giant connected graph. In this question, you are required to answer the total number of people connected at t nodes away from each other ( t distance connectivity). For example: Two persons directly connected are at 1 distance connectivity. While the two persons having a common contact without having direct connectivity, are at 2 distance connectivity. Input Format First line of input line contains, two integers n and e, where n is the nodes and e are the edges. Next e lines will contain two integers u and v meaning that node u and node v are connected to each other in undirected fashion. Next line contains single integer, m, which is number of queries. Next m lines, each have two inputs, one as source node and other as a required t distance connectivity which should be used to process query. Output Format Print a single integer represents the total number of people connected at t nodes away from the source node (t distance connectivity). Example Run: Explanation After creating the graph, there was 3 queries, i. Source node. 4 , and we have to find out total number of nodes at a distance of 2 from node 4. 1(4>2>1),8(47>8),9(4>7>9);6(47>>0)=4 ii. Similarly as above iii. Source node: 2 , and we have to find out total number of nodes at a distance of 1 from node 2. 1(2>1),4(2>4),3(2>3)=3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions