Lecture 15 CSE 331 Oct 3, 2011.

Slides:



Advertisements
Similar presentations
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.
Advertisements

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.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
CSE 421 Algorithms Richard Anderson Autumn 2015 Lecture 5.
Data Structures and Algorithm Analysis Lecture 5
Breadth-First Search (BFS)
Lecture 16 CSE 331 Oct 5, 2011.
CSE 373 Topological Sort Graph Traversals
Chapter 3. Decompositions of Graphs
Lecture 11 Graph Algorithms
Graph Algorithms BFS, DFS, Dijkstra’s.
CSE 2331/5331 Topic 9: Basic Graph Alg.
Csc 2720 Instructor: Zhuojun Duan
CSE373: Data Structures & Algorithms Lecture 16: Introduction to Graphs Linda Shapiro Winter 2015.
Lecture 12 Graph Algorithms
Lecture 20 CSE 331 Oct 15, 2010.
Lecture 15 CSE 331 Oct 3, 2016.
Lecture 16 CSE 331 Oct 5, 2016.
Lecture 17 CSE 331 Oct 3, 2014.
Depth-First Search.
Instructor: Lilian de Greef Quarter: Summer 2017
CS120 Graphs.
Graph.
CSE373: Data Structures & Algorithms Lecture 16: Introduction to Graphs Linda Shapiro Spring 2016.
Lecture 15 CSE 331 Oct 5, 2012.
Lecture 15 CSE 331 Sep 29, 2014.
Lecture 15 CSE 331 Oct 3, 2016.
Lecture 10 Algorithm Analysis
Graphs Chapter 13.
Graphs Chapter 15 explain graph-based algorithms Graph definitions
Lecture 14 CSE 331 Sep 30, 2016.
Lecture 12 CSE 331 Sep 26, 2016.
Lecture 12 CSE 331 Sep 25, 2017.
Lecture 14 CSE 331 Sep 30, 2011.
Lecture 17 CSE 331 Oct 10, 2012.
Lecture 13 CSE 331 Oct 1, 2012.
Chapter 22: Elementary Graph Algorithms I
Chapter 11 Graphs.
Connected Components, Directed Graphs, Topological Sort
Lecture 13 CSE 331 Sep 27, 2017.
Lecture 16 CSE 331 Oct 4, 2017.
Lecture 2 CSE 331 Sep 1, 2011.
CSE 373 Graphs 4: Topological Sort reading: Weiss Ch. 9
Richard Anderson Autumn 2016 Lecture 5
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.
Richard Anderson Winter 2009 Lecture 6
Depth-First Search CSE 2011 Winter April 2019.
Lecture 11 CSE 331 Sep 19, 2014.
Lecture 11 CSE 331 Sep 21, 2017.
Lecture 12 CSE 331 Sep 22, 2014.
Graph Traversal Lecture 18 CS 2110 — Spring 2019.
Lecture 17 CSE 331 Oct 7, 2011.
GRAPHS G=<V,E> Adjacent vertices Undirected graph
CSE 417: Algorithms and Computational Complexity
Lecture 11 CSE 331 Sep 22, 2016.
Richard Anderson Winter 2019 Lecture 6
Lecture 15 CSE 331 Oct 4, 2010.
Lecture 10 Graph Algorithms
Lecture 11 Graph Algorithms
Richard Anderson Winter 2019 Lecture 5
Lecture 13 CSE 331 Sep 28, 2016.
Presentation transcript:

Lecture 15 CSE 331 Oct 3, 2011

Mid term Next Monday in class Unfortunately I won’t be there Jiun-Jie with my PhD students Steve & Swapnoneel will proctor the exam

Feedback Response-I I’ll use the microphone today Let me know via poll on the blog if it worked better

Graphs will help us here Feedback Response-II Problem Statement Real world problem Graphs will help us here Problem Definition Precise mathematical def Algorithm “Implementation” Data Structures Analysis Correctness/Run time

Feedback Response-III The workload is “insane” and I might be unaware of it Syllabus states that you’re supposed to spend at least 8-12 hours outside of the lectures If you’re spending much more time than above, please come and talk to me I’m aware that ideal situations do not always exists More chances for you to “make-up” in the course

Mid term entry Has been posted on the blog Don’t read too much into the content of the sample mid-term

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…

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)

2 # edges = sum of # neighbors 2m = Σ u in V nu Rest of the graph Give 2 pennies to each edge Total # of pennies = 2m nv=3 u nu=4 v Each edges gives one penny to its end points # of pennies u receives = nu

Questions?

Today’s agenda Run-time analysis of BFS

Breadth First Search (BFS) Build layers of vertices connected to s L0 = {s} Assume L0,..,Lj have been constructed Lj+1 set of vertices not chosen yet but are connected to Lj Use CC[v] array Stop when new layer is empty Use linked lists

An illustration 1 2 3 4 5 7 8 6 1 7 2 3 8 4 5 6

Implementing DFS in O(m+n) time Same as BFS except stack instead of a queue

A DFS run using an explicit stack 7 8 1 7 7 6 3 2 3 5 8 4 4 5 5 3 6 2 3 1

Reading Assignment Sec 3.3, 3.4 and 3.5 of [KT]

Directed graphs Model asymmetric relationships Precedence relationships u needs to be done before v means (u,v) edge

Directed graphs Adjacency matrix is not symmetric Each vertex has two lists in Adj. list rep.

Directed Acyclic Graph (DAG) No directed cycles Precedence relationships are consistent

Topological Sorting of a DAG Order the vertices so that all edges go “forward”