1
CSE 421
Algorithms
Richard Anderson
Lecture 5
Graph Theory
Bipartite
•
A graph is bipartite if its vertices can be
partitioned into two sets V
1
and V
2
such
that all edges go between V
1
and V
2
•
A graph is bipartite if it can be two colored
Theorem: A graph is bipartite if and
only if it has no odd cycles
Lemma 1
•
If a graph contains an odd cycle, it is not
bipartite
Lemma 2
•
If a BFS tree has an
intralevel edge
, then
the graph has an odd length cycle
Intralevel edge: both end points are in the same level
Lemma 3
•
If a graph has no odd length cycles, then it
is bipartite
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
2
Connected Components
•
Undirected Graphs
Computing Connected
Components in O(n+m) time
•
A search algorithm from a vertex v can find
all vertices in v’s component
•
While there is an unvisited vertex v, search
from v to find a new component
Directed Graphs
•
A Strongly Connected Component is a
subset of the vertices with paths between
every pair of vertices.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '06
 RichardAnderson
 Algorithms, Graph Theory, Vertex, topological sort, strongly connected components

Click to edit the document details