Lecture 6 24 Sept 2013 - Go over exam - representing long numbers variable length array vs linked list compare two numbers test bit 0 test bit k shift by 1 shift by k in-class exercise: "round up to power of two" using variable length array A[i] making linked list practical: store 32 bits per node how to handle non-multiple of 32 bits? in-class exercise: shift right using "packed" linked list ****************************** Computation biology gene regulatory network gene A activates gene B etc queries: Does activating A lead to activating E? What set of genes {A, B, C, ...} equivalent to a given gene A? How represent as a graph? What kind problem does each represent? Strongly connected component definition: A connected B iff path from A to B and vice-versa Claim: "connected" partitions V into disjoint sets of connected nodes. Def: Each set is a strongly connected component. Claim: Every directed graph is a DAG of its strongly connected compoents. Efficiently finding strongly connected components: Idea: pick a node in a SINK SCC; explore the SCC; delete the SCC. Repeat. Why this works: cannot escape a SINK! Problem: how to pick the node, before you have found the SCCs? Claim: If C and C' are SCC's, and there is an edge from a node in C to a node in C', then the highest POST number in C is BIGGER than the highest POST number in C'. Claim: Node that receives HIGHEST post number in a DFS must lie in SOURCE a strongly connected commpoent. But we want a node in a SINK component. Solution: Creat G^R, the reverse of G Algorithm: 1. run DFS on G^R and create list of nodes in decreasing order of POST number. 2. (repeatedly) run DFS on G, starting at unvisited nodes in order of decreasing POST order. Class exercise: turn this into pseudocode!