Академический Документы
Профессиональный Документы
Культура Документы
Application of Breadth-First
Search
Section 3.4
Bipartite Graphs
p
Graph G = (V,E) is
bipartite if
n
V can be partitioned
into sets X and Y in
such a way that every
edge has one end-point
in X and other endpoint in Y
1
PDF created with pdfFactory trial version www.pdffactory.com
Bipartite Graphs
p
Graph G = (V,E) is
bipartite if
n
V can be partitioned
into sets X and Y in
such a way that every
edge has one end-point
in X and other endpoint in Y
Bipartite Graphs
p
Graph G = (V,E) is
bipartite if
n
V can be partitioned
into sets X and Y in
such a way that every
edge has one end-point
in X and other endpoint in Y
2
PDF created with pdfFactory trial version www.pdffactory.com
3
PDF created with pdfFactory trial version www.pdffactory.com
Bipartite Graphs
X = set of red nodes
p Y = set of blue nodes
p Edges are between red and blue nodes
p
n
n
4
PDF created with pdfFactory trial version www.pdffactory.com
3
2
5
PDF created with pdfFactory trial version www.pdffactory.com
3
2
3
2
6
PDF created with pdfFactory trial version www.pdffactory.com
3
2
Node 2k = blue
Node 2k + 1 = ?
7
PDF created with pdfFactory trial version www.pdffactory.com
8
PDF created with pdfFactory trial version www.pdffactory.com
9
PDF created with pdfFactory trial version www.pdffactory.com
Yes: bipartite
No: not bipartite
10
PDF created with pdfFactory trial version www.pdffactory.com
BFS Coloring
Start exploring from s
p Color s red
p Color layer L1 blue, L2 red, and so on
p Color odd layers blue and even layers red
p Easy to implement on top of BFS!
p
BFS Coloring
11
PDF created with pdfFactory trial version www.pdffactory.com
BFS Coloring
Set
color[v]
here
12
PDF created with pdfFactory trial version www.pdffactory.com