Suppose you have an array of integers, and you want to try a divide-and-conquer method for finding the sum of the integers: split the array in half, sum each half, and then add the two sums to get the final result.
The program graph.py
has a Graph
class, with a load
method
that loads graph descriptions from text files, and a
breadthFirstSearch
method that returns the results
of a breadth-first search of a graph. It also includes stubs
for a getShortestPaths
method and a getTopologicalSort
method. Here are a couple tiny sample graphs:
directed.txt and
undirected.txt.
getShortestPaths
or
getTopologicalSort
and implement it.
Your implementation should adhere to the specification comment
at the top of the method.