Lecture 12 CSE 331 Sep 26, 2016.

Slides:



Advertisements
Similar presentations
Minimum Spanning Tree Sarah Brubaker Tuesday 4/22/8.
Advertisements

Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
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 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 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.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
CISC220 Fall 2009 James Atlas Nov 13: Graphs, Line Intersections.
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.
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 5.
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.
CSE 421 Algorithms Richard Anderson Autumn 2015 Lecture 5.
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.
CSC 172 DATA STRUCTURES.
GRAPH TRAVERSING BY PROF. UZAIR SALMAN
CSE 373 Data Structures and Algorithms
Graph Algorithms BFS, DFS, Dijkstra’s.
Discrete Mathematicsq
CSE 2331/5331 Topic 9: Basic Graph Alg.
Graph Search Lecture 17 CS 2110 Fall 2017.
Lecture 12 Graph Algorithms
CS120 Graphs.
Graph Search Lecture 17 CS 2110 Spring 2018.
Lecture 15 CSE 331 Oct 5, 2012.
Lecture 15 CSE 331 Sep 29, 2014.
CSE 421: Introduction to Algorithms
Lecture 10 Algorithm Analysis
Lecture 14 CSE 331 Sep 30, 2016.
Lecture 12 CSE 331 Sep 25, 2017.
Lecture 14 CSE 331 Sep 30, 2011.
Can you get there from here?
Lecture 13 CSE 331 Oct 1, 2012.
Chapter 22: Elementary Graph Algorithms I
Lectures on Graph Algorithms: searching, testing and sorting
Graph Algorithms What is a graph? V - vertices E µ V x V - edges
Elementary Graph Algorithms
What is a Graph? a b c d e V= {a,b,c,d,e} E= {(a,b),(a,c),(a,d),
Lecture 13 CSE 331 Sep 27, 2017.
CSE 421: Introduction to Algorithms
CSE 373 Data Structures Lecture 16
Lecture 13 CSE 331 Sep 24, 2013.
Richard Anderson Autumn 2016 Lecture 5
Subgraphs, Connected Components, Spanning Trees
Algorithms Lecture # 30 Dr. Sohail Aslam.
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.
Graph Algorithms "A charlatan makes obscure what is clear; a thinker makes clear what is obscure. " - Hugh Kingsmill CLRS, Sections 22.2 – 22.4.
Richard Anderson Winter 2009 Lecture 6
Lecture 15 CSE 331 Oct 3, 2011.
Depth-First Search CSE 2011 Winter April 2019.
CSE 373: Data Structures and Algorithms
Lecture 11 CSE 331 Sep 19, 2014.
Lecture 11 CSE 331 Sep 21, 2017.
Lecture 12 CSE 331 Sep 22, 2014.
GRAPHS G=<V,E> Adjacent vertices Undirected graph
A vertex u is reachable from vertex v iff there is a path from v to u.
Lecture 11 CSE 331 Sep 22, 2016.
Applications of BFS CSE 2011 Winter /17/2019 7:03 AM.
Richard Anderson Winter 2019 Lecture 6
Lecture 15 CSE 331 Oct 4, 2010.
CSE 373: Data Structures and Algorithms
Lecture 11 Graph Algorithms
Richard Anderson Winter 2019 Lecture 5
Lecture 13 CSE 331 Sep 28, 2016.
Richard Anderson Autumn 2015 Lecture 6
Presentation transcript:

Lecture 12 CSE 331 Sep 26, 2016

Mini Project group due TODAY!

Connectivity Problem Input: Graph G = (V,E) and s in V Output: All t connected to s in G

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 Stop when new layer is empty

BFS Tree BFS naturally defines a tree rooted at s Add non-tree edges Lj forms the jth “level” in the tree u in Lj+1 is child of v in Lj from which it was “discovered” 1 7 9 1 L0 2 3 L1 2 3 8 4 5 4 5 7 8 L2 6 6 L3

Today’s agenda Every edge in is between consecutive layers Computing Connected component

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* = R

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)