lec12 - 6.006- Introduction to Algorithms Lecture 12 Graph...

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

View Full Document Right Arrow Icon
6.006- Introduction to Algorithms Lecture 12 – Graph Algorithms Prof. Manolis Kellis CLRS 22.2-22.3
Background image of page 1

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

View Full DocumentRight Arrow Icon
Combinatorics Ponytail No ponytail Beard Erik ? No Beard Piotr Manolis
Background image of page 2
Unit #4 – Games, Graphs, Searching, Networks 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Unit #4 Overview: Searching Today: Introduction to Games and Graphs Rubik’s cube, Pocket cube, Game space Graph definitions, representation, searching Tuesday: Graph algorithms and analysis Breadth First Search, Depth First Search Queues, Stacks, Augmentation, Topological sort Thursday: Networks in biology and real world Network/node properties, metrics, motifs, clusters Dynamic processes, epidemics, growth, resilience
Background image of page 4
Last time: Games and Graphs
Background image of page 5

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

View Full DocumentRight Arrow Icon
Pocket Cube 2 × 2 × 2 Rubik’s cube Start with any colors Moves are quarter turns of any face “Solve” by making each side one color
Background image of page 6
Searching for a solution path Graph algorithms allow us explore space – Nodes: configurations – Edges: moves between them – Paths to ‘solved’ configuration: solutions 1 turn 6 neighbors 27 two-away How big is the space?
Background image of page 7

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

View Full DocumentRight Arrow Icon
Graphs V={a,b,c,d} E={{a,b}, {a,c}, {b,c}, {b,d}, {c,d}} V = {a,b,c} E = {(a,c), (a,b) (b,c), (c,b)} a c d b a b c G=(V,E) V a set of vertices Usually number denoted by n E V × V a set of edges (pairs of vertices) Usually number denoted by m Note m n(n-1) = O(n 2 ) Undirected example Directed example
Background image of page 8
Graph Representation Adjacency lists Incidence lists Adjacency matrix Implicit representation a b c c c / b / b / a b c (a,c) (a,b) / (b,c) / (c,b) / a (1) b (2) c (3) 0 1 1 a (1) 0 0 1 b (2) 0 1 0 c (3) Neighbors(a) [c,b] Neighbors(b) [b] Neighbors(c) [b] a b c
Background image of page 9

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

View Full DocumentRight Arrow Icon
Today: Searching graphs ?
Background image of page 10
Searching Graph We want to get from current Rubik state to “solved” state How do we explore?
Background image of page 11

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

View Full DocumentRight Arrow Icon
Breadth First Search start with vertex v list all its neighbors (distance 1) then all their neighbors (distance 2) etc. algorithm starting at s: define frontier F initially F={s} repeat F=all neighbors of vertices in F until all vertices found
Background image of page 12