Question: Please write this following code in C The first task is to implement the required functions prototyped in graph.h for reading in the data from
Please write this following code in C


The first task is to implement the required functions prototyped in graph.h for reading in the data from a test file and constructing a valid representation of the undirected graph. Test cases are formatted as such: the first line contains a single integer, denoting the number of airports in the graph, followed by a newline character. The remaining lines will be composed of two three letter airport codes separated by a single whitespace followed by an integer and a new line character. Each line represents bidirectional flight containing two airports whose flight cost given by the value. Consider sample input below as an example. ORD BWI 621 ORD BOS 867 BOS SFO 2704 ORD SFO 1846 BWI JFK 184 MIA BWI 946 JFK MIA 1090 BOS JFK 187 ORD DFW 802 LAX MIA 2342 PVD JFK 144 MIA BOS 1258 LAX SFO 337 DFW JFK 1391 DFW SFO 1464 ORD JFK 740 DEW LAX 1235 MIA DFW 1121 PVD ORD 849 Note that the resulting graph would be ORD BWI BOS SFO DFW JFK PVID BWI ORD JFK MIA BOS ORD SFO JFK MIA SFO BOS ORD LA DFW JFK BWI MLA BOS PVID DFW ORD MLA BWI JFK LAX BOS DFW DFW ORD JFK SFO LAX MLA. LAX MLA SFO DFW PVD JFK ORD The first task is to implement the required functions prototyped in graph.h for reading in the data from a test file and constructing a valid representation of the undirected graph. Test cases are formatted as such: the first line contains a single integer, denoting the number of airports in the graph, followed by a newline character. The remaining lines will be composed of two three letter airport codes separated by a single whitespace followed by an integer and a new line character. Each line represents bidirectional flight containing two airports whose flight cost given by the value. Consider sample input below as an example. ORD BWI 621 ORD BOS 867 BOS SFO 2704 ORD SFO 1846 BWI JFK 184 MIA BWI 946 JFK MIA 1090 BOS JFK 187 ORD DFW 802 LAX MIA 2342 PVD JFK 144 MIA BOS 1258 LAX SFO 337 DFW JFK 1391 DFW SFO 1464 ORD JFK 740 DEW LAX 1235 MIA DFW 1121 PVD ORD 849 Note that the resulting graph would be ORD BWI BOS SFO DFW JFK PVID BWI ORD JFK MIA BOS ORD SFO JFK MIA SFO BOS ORD LA DFW JFK BWI MLA BOS PVID DFW ORD MLA BWI JFK LAX BOS DFW DFW ORD JFK SFO LAX MLA. LAX MLA SFO DFW PVD JFK ORD
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
