Question: This program exercises graphs. # Replace any comments with your own code statement(s) # to accomplish the specified task. # Do not change

This program exercises graphs.

# Replace any "" comments with your own code statement(s) # to accomplish the specified task. # Do not change any other code.

# The following files must be in the same folder: # abstractcollection.py # graph.py

from graph import LinkedDirectedGraph

# Part 1: # Complete the following function: def topologicalSort(graph): #

graph = LinkedDirectedGraph()

# The graph represents the following course prerequisites: # A requires nothing # B requires nothing # C requires A # D requires A, B, and C # E requires C # F requires B and D # G requires E and F # H requires C, F, and G

# Part 2: # Add the vertices: #

# Part 3: # Add the edges: #

print("Graph:") print(graph) print()

print("Courses:") # Part 4: # Display each vertex on a separate line: # print()

print("Prerequisites:") # Part 5: # Display each edge on a separate line: # print()

print("One possible order to take the courses:") # Part 6: # Display the courses in prerequisite (topological) order: # print ()

PLEASE HELP! THANKS! I WILL RATE YOU!

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!