CISC 320 Algorithms, Fall 2007
Homework set #3, due Fri, Oct. 5.
Let n nodes be given labeled 1, 2, ... n and define the triangular graph on these nodes to be the graph Tn in
which there is an edge (i,j) if and only if i + j ≤ n + 1 and i ≠ j. The term "triangular"
refers to the fact that the adjacency matrix has a triangular pattern.
The adjacency lists representation is:
1: 2, 3, 4, 5
2: 1, 3, 4
3: 1, 2
4: 1, 2
5: 1
Let the weight of each edge (i,j) be |i-j|, the absolute value of i - j.
Thus Tn is a weighted connected undirected graph.
-
- Draw T5
- Draw the breadth first search tree in T5 that results when starting at node 1.
- Draw the breadth first search tree in T5 that results when starting at node 5.
- Draw the depth first search tree in T5 that results when starting at node 1.
- Draw the depth first search tree in T5 that results when starting at node 5.
-
- Show the shortest path tree that results from Dijkstra's algorithm in T5 when starting at node 1.
- Show the shortest path tree that results from Dijkstra's algorithm in T5 when starting at node 5.
-
- Show the minimal spanning tree that results from Prim's algorithm in T5 when starting at node 1.
- Show the minimal spanning tree that results from Prim's algorithm in T5 when starting at node 5.
- Show the minimal spanning tree that results from Kruskal's algorithm in T5.
-
True or false ( prove or give counterexample): Every triangular graph has a unique minimum spanning tree.
-
True or false ( prove or give counterexample): A connected edge-weighted undirected graph in which the edge weightes are distinct (no two weights are equal) has a unique minimum spanning tree.
-
Dijkstra's algorithm may be viewed as breadth first search with the queue of nodes to be visited replaced by a priority queue. In particular for a weighted connected graph with all the weights equal, Dijkstra's algorithm and BFS construct exactly the same search tree. Construct a weighted connected graph such that the spanning tree constructed by Dijkstra's algorithm and the tree by depth first search are the same.
- Chapter 4, Exercise 9 (Bottleneck).