Lecture 14 CSE 331 Sep 30, 2011.

Slides:



Advertisements
Similar presentations
Lecture 30 CSE 331 Nov 8, HW 7 due today Place Q1, Q2 and Q3 in separate piles I will not accept HWs after 1:15pm DO NOT FORGET TO WRITE DOWN YOUR.
Advertisements

Lecture 13 CSE 331 Oct 2, Announcements Please turn in your HW 3 Graded HW2, solutions to HW 3, HW 4 at the END of the class Maybe extra lectures.
Lecture 16 CSE 331 Oct 9, Announcements Hand in your HW4 Solutions to HW4 next week Remember next week I will not be here so.
Lecture 12 CSE 331 Sep 30, Announcements Final exam: Dec 16, 11:45am-2:45pm, NSC 210 HW 2 solutions at the end of the lecture Mid term: Oct 16,
Lecture 15 CSE 331 Oct 7, Mid-term stuff Chapters 1-3 in [KT] Sample mid-term (and graded HW3) at the END of class The web version has the correct.
Lecture 14 CSE 331 Oct 5, Extra lectures on proofs Tuesday 5-6pm (Jeff) Wednesday 4:30-6pm (Atri) Commons 9 Prefer my name to Professor/Dr. Rudra.
Lecture 17 CSE 331 Oct 8, HW 4 due today Q1 and Q2 in one pile Q3 in another pile I will not take any HW after 1:15pm.
Lecture 18 CSE 331 Oct 11, Mid term Next Monday in class.
Lecture 13 CSE 331 Oct 2, Announcements Mid term in < 2 weeks Graded HW2 at the END of the class.
Brute Force and Exhaustive Search Brute Force and Exhaustive Search Traveling Salesman Problem Knapsack Problem Assignment Problem Selection Sort and Bubble.
Representing Graphs Depth First Search Breadth First Search Graph Searching Algorithms.
Lecture 16 CSE 331 Oct 5, 2011.
CSE 373 Topological Sort Graph Traversals
Lecture 11 Graph Algorithms
Graph Algorithms BFS, DFS, Dijkstra’s.
CSE 2331/5331 Topic 9: Basic Graph Alg.
Graph Search Lecture 17 CS 2110 Fall 2017.
Lecture 20 CSE 331 Oct 15, 2010.
Lecture 23 CSE 331 Oct 26, 2016.
Lecture 17 CSE 331 Oct 3, 2014.
CS120 Graphs.
Lecture 22 CSE 331 Oct 22, 2010.
Lecture 15 CSE 331 Oct 5, 2012.
Lecture 15 CSE 331 Sep 29, 2014.
Lecture 14 CSE 331 Sep 30, 2016.
Lecture 12 CSE 331 Sep 26, 2016.
Lecture 12 CSE 331 Sep 25, 2017.
Lecture 17 CSE 331 Oct 10, 2012.
Lecture 13 CSE 331 Oct 1, 2012.
Lecture 24 CSE 331 Oct 25, 2013.
Chapter 22: Elementary Graph Algorithms I
Graph Algorithms What is a graph? V - vertices E µ V x V - edges
Lecture 23 CSE 331 Oct 25, 2017.
Lecture 23 CSE 331 Oct 24, 2011.
Lecture 26 CSE 331 Nov 2, 2012.
Lecture 22 CSE 331 Oct 24, 2016.
Lecture 13 CSE 331 Sep 27, 2017.
Lecture 13 CSE 331 Sep 24, 2013.
Lecture 37 CSE 331 Nov 30, 2011.
Lecture 18 CSE 331 Oct 12, 2011.
Depth-First Search D B A C E Depth-First Search Depth-First Search
Algorithms Lecture # 30 Dr. Sohail Aslam.
Lecture 19 CSE 331 Oct 13, 2010.
Lecture 14 CSE 331 Oct 3, 2012.
Lecture 12 CSE 331 Sep 28, 2012.
Lecture 12 CSE 331 Sep 26, 2011.
Lecture 14 CSE 331 Sep 29, 2017.
Lecture 16 CSE 331 Oct 8, 2012.
Lecture 16 CSE 331 Oct 2, 2013.
Lecture 11 CSE 331 Sep 23, 2011.
Lecture 15 CSE 331 Oct 3, 2011.
Lecture 39 CSE 331 Dec 5, 2011.
Lecture 11 CSE 331 Sep 19, 2014.
Lecture 24 CSE 331 Oct 24, 2014.
Breadth-First Search L0 L1 L2 C B A E D F Breadth-First Search
Lecture 36 CSE 331 Nov 30, 2012.
Lecture 11 CSE 331 Sep 21, 2017.
Lecture 12 CSE 331 Sep 22, 2014.
Lecture 40 CSE 331 Dec 7, 2011.
Graph Traversal Lecture 18 CS 2110 — Spring 2019.
Lecture 17 CSE 331 Oct 7, 2011.
Lecture 11 CSE 331 Sep 22, 2016.
Lecture 25 CSE 331 Oct 28, 2011.
3.2 Graph Traversal.
Lecture 15 CSE 331 Oct 4, 2010.
Lecture 10 Graph Algorithms
Lecture 11 Graph Algorithms
Lecture 13 CSE 331 Sep 28, 2016.
Lecture 11 CSE 331 Sep 20, 2013.
Presentation transcript:

Lecture 14 CSE 331 Sep 30, 2011

HW 3 due today I will not take any HW after 1:15pm Q1, Q2 and Q3 in different piles I will not take any HW after 1:15pm

Other HW related annoucements Solutions to HW 3 handed out at the END of the lecture Pick up graded HW 2 from recitation/TA office hours next week HW 4 (and rubric) has been posted (link on the blog)

Mid-term related stuff Sample mid term posted (link on the blog) Blog entry on mid-term exam prep.

On Friday, Oct 7 hours-a-thon Atri: 2:00-3:00 (Bell 123) Jiun-Jie: 4:00-5:00 (Commons 9) Jesse: 5:00-6:00 (Bell 224)

Empty Slots Coming up…

Computing Connected Component Explore(s) Start with R = {s} While exists (u,v) edge v not in R and u in R Add v to R Output R

Explore(s) = Connected Comp.(s) Lemma 1: If w is in R then s is connected to w Lemma 2: If s is connected to w then w is in R

Also argued that m ≤ n(n-1)/2

HW 3 due today I will not take any HW after 1:15pm Q1, Q2 and Q3 in different piles I will not take any HW after 1:15pm

Questions?

BFS all

Depth First Search (DFS) http://xkcd.com/761/

DFS(u) Mark u as explored and add u to R For each edge (u,v) If v is not explored then DFS(v)

Why is DFS a special case of Explore?

Every non-tree edge is between a node and its ancestor A DFS run Every non-tree edge is between a node and its ancestor DFS(u) u is explored For every unexplored neighbor v of u DFS(v) 1 1 7 2 2 3 8 4 4 5 5 DFS tree 6 6 3 8 7

Questions?

Connected components are disjoint Either Connected components of s and t are the same or are disjoint Algorithm to compute ALL the connected components? Run BFS on some node s. Then run BFS on t that is not connected to s

Reading Assignment Sec 3.2 in [KT]

Rest of today’s agenda Run-time analysis of BFS (DFS)

Stacks and Queues Last in First out First in First out

But first… How do we represent graphs?

Graph representations 1 Better for sparse graphs and traversals Adjacency matrix Adjacency List (u,v) in E? O(1) O(n) [ O(nv) ] All neighbors of u? O(n) O(nu) O(n2) Space? O(m+n)