Download Presentation
## Lab 10 12/1

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Project 2 Grades**• Grades rescaled • +5 points • To a maximum of 105/100.**Project 3 Grade Scale**• 80: A program that compiles, runs, halts and returns a sensical answer. • Sensical: 0 < k < |V|+1 • +10 if your wrong answer is reasonable. • A 30-color coloring of a 20-colorable graph is reasonable. • A 50-color coloring might be too, if there are around 500 vertices. • A 100-color coloring probably wouldn’t be. • +10 if your answer is very close. • Consistantly off by 1-2 • But never *under* the correct answer. • Prof. Cheng’s program gives “very close” answers. • +10 if your answer is correct. • 110/100 • The minimum coloring • Not readily achievable with the assigned algorithm. • -5 points if your program is inefficient. • Takes an extremely long time to halt. • ANDI can find some particularly inefficient code to complain about.**Project 3—Advice for Reading Dimacs Graph Files**• Use Adjacency Matrix representation for the graph. • Read each line of the file... • Use a string tokenizer to break up the line into tokens. • Delimited by space ‘ ‘. • If the first token is “c”, ignore the line. • Otherwise if the first token is ‘p’ then the next token is |V| and the third token is |E|. • So make a |V| x |V| matrix gAdj of booleans. • Initialize all values to false.**Project 3—Advice for Reading Dimacs Graph Files**• If the first token is “e” then the line represents an edge. • The second token is u and the third token is v. • gAdj[u][v]=true; gAdj[v][u]=true;**Homework 4**• Problem 1 • Hint: Given a set X={x1…xn} and a set of subsets Y={{xa…},{xb…},{xc…}} of that set… • Suppose {xa…} is the minimum member of Y. • Suppose we construct X1 and Y1 by squaring every xi. • Does that change the minimum member of Y? • The Shortest Path case is equivalent to the “Hint” problem. • Why? • The Minimum Spanning Tree case is not. • Why?**Homework 4**• Problem 2 • Given G=(V,E) and T a minimum spanning tree of G. • Consider H=(V,E+{x}) • One edge ({x}) has been added. • Two steps: • Make an O(|E|) or O(|V|) algorithm to determine if T is also a minimum spanning tree of H. • Make an O(|E|) algorithm to construct a minimum spanning tree of H (in the case where T is not such a tree).**Homework 4**• Problem 3 • Dynamic programming • You are given the recursion relation. • C(n,k) = C(n-1,k-1) + C(n-1, k) • Follow the examples given in class.