33-AdjListsBFSDFS

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

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

Discussion #33 Chapter 7, Section 5.1-4 1/13 Discussion #33 Adjacency Lists; Breadth-First Search & Depth-First Search

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

View Full Document
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)
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

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

View Full Document
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)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern