lecture03 - 2/10/2009 Graph (undirected) COMPUTER SCIENCE...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
2/10/2009 1 COMPUTER SCIENCE 51 Spring 2009 cs51.seas.harvard.edu Prof. Greg Morrisett Prof. Ramin Zabih Graph (undirected) Graph (directed) Google search: Harvard CS 51 harvard.edu Greg Morrisett SEAS home page CS 51 Courses of Instruction Undirected graph Why care about graphs? Graphs are everywhere Clever solutions to computational problems are often “find the graph” Example: class scheduling w/o conflicts Many programming contests! Finding the graph problem can: Give you a fast solution, or Show there isn’t one So you need to redefine your problem! Basic graph terminology Graph: set of nodes and edges Aka vertices and links Formally: a set plus a pairing relation How it’s drawn doesn’t matter! Neighbors (friends), paths (chains of friends), cycles (paths with repeats) Two connected nodes have a path Connected set: all pairs connected Component if maximal Clique: all pairs are neighbors What can graphs represent Almost anything! Nodes can be: Physical objects (people, circuits) Computational objects (web pages) Places (cities, buildings, rooms) States of affairs (eating, sleeping) ETC, ETC
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2/10/2009 2 Example: class scheduling Some pairs of classes meet at the same time (ex: CS51, CS161) Given a set of conflicting classes, how many courses can you possibly take? Is there a fast way to solve this problem? An independent set is a set of nodes where no pair is a neighbor Sort of the “complement” of a clique Scheduling via graphs Each course is a node An edge means the courses conflict An independent set is a schedule A set of non-conflicting classes Could take K classes iff the graph has
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

lecture03 - 2/10/2009 Graph (undirected) COMPUTER SCIENCE...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online