Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need to do the following program in C language. AIM: Write a program to compute the reliability of a series-parallel graph. Input: A list of

Need to do the following program in C language.

AIM: Write a program to compute the reliability of a series-parallel graph.

Input: A list of lines of the form

Point1 Reliability_Value Point2

Each line represents a single component of reliability Reliability_Value (treated as a double) on a connection defined by two points Point1 and Point2 (treated as character strings) in a series-parallel graph. Note: The order of the lines in the list is arbitrary, as is the order of the points in each line. The list of lines describing the series-parallel graph is terminated by two more lines of the form: START PointS END PointE

where PointS and PointE designate the starting point and ending point of the series-parallel graph, respectively. Note: The words START and END cannot be the name of any points in the series-parallel graph. This is needed so that the program can know when the input terminates.

Algorithm to apply: DO repeatedly in any order you prefer until only one line remains: Merge any two lines with the same endpoints (note that the order of the points is arbitrary) into a single line with the same endpoints and with reliability the corresponding reliability of a parallel connection. If a point (different from the start and end point) appears exactly twice in the list so far, say the point is V and the lines it appears at are U r1 V and V r2 W, replace lines U r1 V and V r2 W with a single line U r3 W, where r3 is the corresponding reliability of a series connection (i.e., r3 = r1 * r2)

The reliability of the system is the reliability of the single remaining line.

Note: Do not use file operations inside the program. Write the program as reading the data from the standard input, and use the operating systems redirection ability to have the program read the data from the text file that contains the description of the series-parallel graph that you want to find the reliability of.

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

Databases Theory And Applications 27th Australasian Database Conference Adc 20 Sydney Nsw September 28 29 20 Proceedings Lncs 9877

Authors: Muhammad Aamir Cheema ,Wenjie Zhang ,Lijun Chang

1st Edition

3319469215, 978-3319469218

More Books

Students also viewed these Databases questions

Question

Discuss the interaction of heredity and environment.

Answered: 1 week ago