CS252 Algorithms Monday, 26 September 2022 + Misc - Apology - Questions about homework? + Graphs: basic definitions & facts - (Undirected) graph - Nodes/vertices (V, book uses n = |V|) - Edges (E, book uses m = |E|) - Directed graph ("digraph") - Degree of a node (undirected/directed?) - Maximum |E| - Path (undirected/directed?) - Cycle (undirected/directed?) - Connected graph - Strongly connected directed graph - Weakly connected directed graph - Tree - Leaf - Root - number of edges + Implementations - Adjacency matrix - Adjacency lists - [Implicit storage] + Applications - Computer networks - Airports & flights - Maps - Dependencies + Algorithm categories - Traversal - Topological sort - [Greedy Algorithms, starting with interval scheduling] - Shortest paths - Spanning trees + ===== Pedagogically, here are some reasons I like looking at Gale-Shapley at the beginning of an Algorithms class. - It is pretty easy to understand the setup. - Even though the algorithm has a pretty quick correctness proof, there are parts of the proof that are not obvious. - The algorithm has some properties that are *really* not obvious. (The one that stands out for me is that it doesn't matter the order in which the main loop chooses the free proposers--you end up at the same matching regardless.) - The solution has weaknesses with respect to real-world applications (e.g. by favoring the preferences of the proposers over the proposees) - There are a dozen easy ways you can imagine adjusting the motivating problem to apply more broadly to matching problems. That is, the core GS setup is artificial, but the idea stretches pretty far with some modifications. - Because the original problem is so obviously artificial, studying it prods you into trying to imagine its extensions into more realistic conditions. Those all speak to some important facts about the algorithmic world: you can't have everything; any algorithmic approach will have both variability and limitations; it takes imagination to stretch an idea to fit an application; mathematical proofs can be very sensitive to small changes; etc. I agree that graphs apply more widely than GS does. I also think it's important to learn some lessons about algorithms from GS.