Answered step by step
Verified Expert Solution
Question
1 Approved Answer
LANGUAGE : PYTHON Graph Theory Scenario UIT and many other universities nationwide are doing a joint project on multimedia. A computer network is built to
LANGUAGE : PYTHON
Graph Theory Scenario UIT and many other universities nationwide are doing a joint project on multimedia. A computer network is built to connect these universities using communication links that construct a graph. The universities decided to install a file server at UIT Karachi to share data. As the link's transmission time is controlled by the link setup and management. so, the cost of a data transfer is directly proportional to the number of links consumed. The target is that UIT Karachi desired to share data with NUST Islamabad by utilizing minimum cost. Draw a graph with the help of these unweighted graph arcs and analyze an algorithm to compute the minimum cost path for sharing of data between UIT Karachi and NUST Islamabad and its cost. NUST Islamabad --> UIT Karachi UIT Karachi UET Lahore UET Lahore BZU Multan NUST Islamabad BZU Multan UET Lahore Faisalabad Uni Faisalabad Uni BZU Multan Implementation Data structure You have to implement the graph by applying a dictionary data structure to hold the vertices and edges in the form of key: value pairs SharedData This class consists of functions that are responsible for creating a graph, calculating the most cost-efficient path between UIT Karachi and NUST Islamabad, and compute its cost. class SharedData: def _init__(self): pass # create a graph of universities with the help of a dictionary # return the created graph named graph def build_graph (self): return graph # calculate the cost-efficient path from the graph # return mincostpath in the form of list # start and end consists of initial and final locations def minimum_cost_path(self, graph, start, end, path=[]) # path=[] intiate populating it from the start # Use for loop to iterate on a graph #recursive call of this function return mincostpath # calculate the cost along the minimum cost path def calculate_cost (self, mincostpath) : #calculate the cost based on edges return pathcost The testing code must print the following output: The cost-efficient path b/w UIT Karachi & NUST Islamabad is: ['UIT Karachi', 'UET Lahore', 'BZU Multan', 'NUST Islamabad'] The cost along this path is: 3Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started