03b Graphs
03b Graphs
1
Graph searching recap II
2
Bipartite Graphs
Applications.
■Scheduling: machines = red, jobs = blue.
■Matching.
a bipartite graph
3
Testing Bipartiteness
v2
v2 v3
v1
v4
v6 v5 v4 v3
v5
v6
v7 v1
v7
4
An Obstruction to Bipartiteness
5
Bipartite Graphs
L1 L2 L3 L1 L2 L3
(i) (ii)
6
Bipartite Graphs
L1 L2 L3
7
Bipartite Graphs
Pf. (ii)
■ Suppose (x, y) is an edge with x, y in same level Lj. z = lca(x, y)
■ Let z = lca(x, y) = lowest common ancestor.
■ Let Li be level containing z.
■ Consider cycle that takes edge from x to y,
then path from y to z, then path from z to x.
■ Its length is 1 + (j-i) + (j-i), which is odd. ▪
(x, y) path from path from
y to z z to x
8
Obstruction to Bipartiteness
5-cycle C
9
Connectivity in Directed Graphs
Directed Graphs
Ex. Web graph - hyperlink points from one web page to another.
■ Directedness of graph is crucial.
■ Modern web search engines exploit hyperlink structure to rank web
pages by importance.
11
Graph Search
Directed s-t shortest path problem. Given two node s and t, what is
the length of the shortest path between s and t?
12
Strong Connectivity
ok if paths overlap
s u
13
Strong Connectivity: Algorithm
14