Spanning Trees and Shortest Paths

Problem: Minimum Spanners

Consider the following weighted, undirected graph:

A weighted, undirected graph

  1. Come up with at least three spanning trees for this graph using the techniques discussed in the reading. Write down the collection of edges that compromises each tree.
  2. When our graphs have weights, we are concerned with finding minimum spanning trees (MSTs), spanning trees whose sum-of-weights-of-edges is minimal for any spanning tree of the graph. Use Prim's algorithm as described in the reading to come up with a MST for this graph. Note the edges of your MST and the sum-of-weights of that tree. Check with an instructor that your MST is indeed the minimal one.

Problem: Jump Up, Superstar!

Example graph, a 3x3 grid of nodes whose edges all have weight one.

In the reading, we explored Dijkstra's algorithm, a fundamental technique for finding the shortest paths of a graph. Here, we explore the algorithm in more detail and then extend it to make it more appropriate for certain real world scenarios.

  1. Run Dijkstra's algorithm on the graph above, starting at vertex . In your write-up, give the resulting shortest paths and their costs from to every other node in the graph.

  2. In many cases, weights in our graph correspond to physical distances between vertices. In these scenarios, the triangle inequality will hold between vertices. For any three vertices , , and that have edges between them, i.e., they form a triangle:

    Where is the weight of edge .

    In a sentence or two, translate what the triangle inequality says with respect to the domain of vertices and lengths of paths between them.

  3. In a sentence or two, explain why the graph from the previous question on spanning trees does not obey the triangle inequality.

  4. In cases where the triangle inequality holds, we can take advantage of this fact by introducing a heuristic function that allows us to better prioritize the nodes we consider during Dijkstra's search. Let be the straight line distance between and target . For example, in the graph from part (a), if we declare our target vertex to be , then:

    All due to the Pythagorean theorem.

    Rerun Dijkstra's on this graph to find the optimal path from to . However, when you need to calculate the next node to process, rather than choosing the minimal , the current best-known path from to , choose the vertex that minimizes:

    In other words, choose the vertex that minimizes the sum of the current best-known path from to and the straight line distance from to . You may stop once you have established the shortest path from to .

    In your write-up, give the sequence of nodes that you visited in your modified algorithm. Also, in your write-up describe in a few sentences how the heuristic function made your shortest path search more efficient.

  5. This extension of Dijkstra's algorithm is called ("A-star") which is a common pathfinding algorithm in many contexts where the graph in question represents physical distances. In this problem, we considered a heuristic function , but it turns out that any heuristic function will work as long as it doesn't overestimate the actual cost to get to the goal node in the graph.

    Discuss why the heuristic function must now overestimate the actual cost of the shortest path. Specifically, what happens to Dijkstra's algorithm if the heuristic function has this bad property?