Lecture 15 CSE 331 Oct 5, 2012.

Slides:



Advertisements
Similar presentations
Graphs CSE 331 Section 2 James Daly. Reminders Homework 4 is out Due Thursday in class Project 3 is out Covers graphs (discussed today and Thursday) Due.
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.
Lecture 12 CSE 331 Sep 28, Upcoming Important Dates Tuesday Oct 8 (~1.5 weeks) Mini Project group compositions Monday Oct 12 (2 weeks) Quiz 1 Monday.
Representing Graphs Depth First Search Breadth First Search Graph Searching Algorithms.
GRAPH TRAVERSING BY PROF. UZAIR SALMAN
Lecture 16 CSE 331 Oct 5, 2011.
CSE 373 Topological Sort Graph Traversals
Graphs -An abstract way of representing connectivity using nodes (also called vertices) and edges vertices edges directed undirected - weighted.
Lecture 11 Graph Algorithms
Graph Algorithms BFS, DFS, Dijkstra’s.
CSE 2331/5331 Topic 9: Basic Graph Alg.
Csc 2720 Instructor: Zhuojun Duan
Graph Search Lecture 17 CS 2110 Fall 2017.
Lecture 12 Graph Algorithms
Lecture 20 CSE 331 Oct 15, 2010.
Lecture 17 CSE 331 Oct 3, 2014.
Instructor: Lilian de Greef Quarter: Summer 2017
CS120 Graphs.
Graph Search Lecture 17 CS 2110 Spring 2018.
Lecture 15 CSE 331 Sep 29, 2014.
Lecture 15 CSE 331 Oct 3, 2016.
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
Lecture 26 CSE 331 Nov 2, 2012.
Yan Shi CS/SE 2630 Lecture Notes
Lecture 13 CSE 331 Sep 27, 2017.
CSE 373 Data Structures Lecture 16
Lecture 13 CSE 331 Sep 24, 2013.
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.
Depth-First Search CSE 2011 Winter April 2019.
Lecture 11 CSE 331 Sep 19, 2014.
Lecture 10 CSE 331 Sep 21, 2012.
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.
Graph Traversal Lecture 18 CS 2110 — Spring 2019.
Lecture 17 CSE 331 Oct 7, 2011.
GRAPHS G=<V,E> Adjacent vertices Undirected graph
CS Fall 2012, Lab 11 Haohan Zhu.
Lecture 11 CSE 331 Sep 22, 2016.
Lecture 25 CSE 331 Oct 28, 2011.
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 15 CSE 331 Oct 5, 2012

HW 4 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 stuff HW 5 has been posted online: see blog/piazza Solutions to HW 4 at the END of the lecture Graded HW 3: pickup from TAs next week

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)

HW 4 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?

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

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]