33-AdjListsBFSDFS

33-AdjListsBFSDFS - Discussion #33 Adjacency Lists;...

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

View Full Document Right Arrow Icon
Discussion #33 Chapter 7, Section 5.1-4 1/13 Discussion #33 Adjacency Lists; Breadth-First Search & Depth-First Search
Background image of page 1

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

View Full DocumentRight Arrow Icon
Discussion #33 Chapter 7, Section 5.1-4 2/13 Topics Adjacency list representation Dense & sparse graphs Breadth-First Search (BFS) Depth-First Search (DFS)
Background image of page 2
Discussion #33 Chapter 7, Section 5.1-4 3/13 Adjacency Lists For directed graphs: b a c 1 a 1 2 3 2 b 3 3 c 2 b c c b c b a a Simple Notation { (a,a), (a,b), (a,c), (b,c), (c,b) } 0 1 0 c 1 0 0 b 1 1 1 a c b a
Background image of page 3

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

View Full DocumentRight Arrow Icon
Discussion #33 Chapter 7, Section 5.1-4 4/13 Space: Adjacency Lists vs. Matricies Space ( n vertices and m edges) matrix: n 2 + n × (vertex-name size) = matrix size + header size matrix can be bits, but bits are not directly addressable list: n × (header-node size) + m × (list-node size) Sparse: few edges 0 in the extreme case Matrix fixed size: so no size benefit List variable size: as little as n × (vertex-node size) Dense: many edges n 2 in the extreme case Matrix fixed size: so no size loss List variable size: as much as n × (header-node size) + n 2 × (list-node size)
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/02/2012 for the course C S 236 taught by Professor Michaelgoodrich during the Winter '12 term at BYU.

Page1 / 13

33-AdjListsBFSDFS - Discussion #33 Adjacency Lists;...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online