Lecture 11 CSE 331 Sep 25, 2009. Homeworks Please hand in your HW 2 now HW 3 and graded HW 1 at the end of class.

Post on 22-Dec-2015

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

Lecture 11

CSE 331Sep 25, 2009

Homeworks

Please hand in your HW 2 now

HW 3 and graded HW 1 at the end of class

GraphsRepresentation of relationships between pairs of entities/elements

VertexVertex

EdgeEdge

# vertices = n

#edges = m

# vertices = n

#edges = m

Paths

Sequence of (distinct) vertices connected by edges

, , ,

Path length 3Path length 3

,

ConnectedConnected

Connected Graphs

Every pair of vertices has a path between them

Cycles

Sequence of k vertices connected by edges, first k-1 are distinct

, , ,

TreeConnected undirected graph with no cycles

Rooted Tree

A rooted tree

Pick any vertex as root

Let the rest of the tree hang under “gravity”

How many rooted trees

can an n vertex tree

have?

How many rooted trees

can an n vertex tree

have?

SG’s parent=AC

SG’s parent=AC

AC’s child=SG

AC’s child=SG

Rest of Today’s agenda

Prove n vertex tree has n-1 edges

Algorithms for checking connectivity

Checking by inspection

What about large graphs?

s

t

Are s and t connected?

Brute-force algorithm?

List all possible vertex sequences between s and t

Check if any is a path between s and t

2n such sequences

2n such sequences

Algorithm motivation

allall

top related