Question: solve this in python and Don't take input from user You are given a piece of python code and a txt file named graph.txt. The

 solve this in python and Don't take input from user You

solve this in python and Don't take input from user

You are given a piece of python code and a txt file named graph.txt. The input file contains the number of vertices in the first line, n, followed by the number of connections, c. Then there are c numbers of lines mentioning the connection between a pair of vertices in the form a,ba is connected to b. The graph given is a directed graph. If you look at the python file you will see that the methods readFile() and buildGraphusingDictionary() have been done for you. Not only that, comments have been added for you to understand how each line is working and why it has been used. Read the comments very carefully and study the code and of course run the code to match your input with the output. Your job is to complete the buildGraphusinglistoflists() method and the printGraph() method. Google "list of lists in python" to aid you complete the tasks

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!