Document 13594355

advertisement
Mathematics for Computer Science
Types of Graphs
MIT 6.042J/18.062J
Directed Graphs
Undirected Graphs
(Simple)
Undirected Graphs:
Isomorphism
Multi-Graphs
lec 4F.1
September 30, 2005
Copyright © Albert R. Meyer, 2005.
Definition
Connections not layout
a
An Undirected Graph is a set of vertices V and a set of edges E
where each edge is an unordered pair of distinct vertices a and b.
a—b (edge ab) = {a,b}
99
lec 4F.3
Isomorphic Graphs
257
Ronitt
David
Albert
“same” graph, different labels
September 30, 2005
September 30, 2005
lec 4F.4
u—v is in E1 iff f(u)—f(v) is in E2
There is a one-to-one correspondence
between the nodes of G1 and G2 that
preserves all edge connections.
Hanson
Copyright © Albert R. Meyer, 2005.
Copyright © Albert R. Meyer, 2005.
145
Graphs G1 and G2 are isomorphic if
there exists a bijection f: V1 → V2 such that
for all u,v in V1
Jelani
Sayad
99
306
Graph Isomorphism
67
306
67
306
67
Same graph, different
layouts
September 30, 2005
145
122
257
145
99
b
deg(b) = 4
Copyright © Albert R. Meyer, 2005.
122
122
257
Degree of a vertex v is the number of edges it connects to.
deg(a) = 2
lec 4F.2
September 30, 2005
Copyright © Albert R. Meyer, 2005.
lec 4F.5
Copyright © Albert R. Meyer, 2005.
September 30, 2005
lec 4F.6
1
Are these Isomorphic?
Dog
Find a Mapping
Hay
Pig
Dog
hay
Pig
Corn
Cow
Copyright © Albert R. Meyer, 2005.
Cat
Beef
corn
Cow
Tuna
September 30, 2005
lec 4F.7
Cat
Copyright © Albert R. Meyer, 2005.
beef
Function
f(Dog) = beef
f(Cat) = tuna
f(Cow) = hay
f(Pig) = corn
tuna
September 30, 2005
lec 4F.8
Finding the Mapping
• Not easy, can try all possible mappings
Class Problems
1&2
– Roughly n! possibilities
• Can test for Invariants
– Same number of nodes, edges
– Same degree distributions
– Preserves cycles, longest path, etc
Copyright © Albert R. Meyer, 2005.
September 30, 2005
lec 4F.9
Copyright © Albert R. Meyer, 2005.
September 30, 2005
lec 4F.10
2
Download