# This is a template for your solutions to problem set 6. Adhere
# carefully to the instructions in the comments so that the autograder
# can make sense of your program!
import nhpn
class ProblemSet6:
"""Responses to problem set 6 (shortest paths)."""
def __init__(self):
"""Instantiate the loader once for all time so that we can avoid
wasting time on it repeatedly."""
self.loader = nhpn.Loader()
# Problem 3(a)
def node_by_name(self, nodes, description, state):
"""Returns the first node that matches specified location.
The description of the node should include description,
and the state of the node should match the state.
If there is no such node, return None."""
# YOUR CODE GOES HERE
return None
# Problem 3(b)
def lat_long_length(self, node1, node2):
"""Returns the distance between node1 and node2, ignoring the
earth's curvature."""
# YOUR CODE GOES HERE
return None
# Problem 3(c)
def dijkstra_search(self, nodes, edges, weight, source, destination):
"""Finds the shortest path from source to destination in the
graph (nodes and edges), where the weight on edge (u, v) is
given by weight(u, v). Assumes that all weights are
non-negative. Returns a list of nodes on the path."""
# YOUR CODE GOES HERE
return None