Graphs and Gates Exam Edition
Graphs and Gates Exam Edition
Graphs and Gates Exam Edition
Graph Theory
7.1. Graphs
a b
d c
a b
d c
d c
Since deg(v) is even for v ∈ Ve , the first sum in the right hand side of
the equality is even. The total sum must be 2e, which is even, so the
second sum must be even too. But its terms are all odd, so there must
be an even number of them.
7.1. GRAPHS 85
a b
6 3
6
d 4 c
010 011
100 101
000 001
e b
d c
a
q
b
r
c
Regular Graph: a simple graph whose vertices have all the same
degree. For instance, the n-cube is regular.
a b c d
a 0 1 0 1
b 1
0 2 0
c 0 2 0 0
d 1 0 0 1
b
e2
e1
e3
a c
e4 e5
d
Figure 7.8
1For some authors if i = j then the entry is twice the number of loops incident
on i; so in the example of figure 7.8 entry (d, d) would be 2 instead of 1.
7.2. REPRESENTATIONS OF GRAPHS 89
e1 e2 e3 e4 e5
a 1 0 0 1 0
b 1 1 1 0 0
c 0 1 1 0 0
d 0 0 0 1 1
a1 b1 a2 b2
d2
e1 c2
c1 e2
d1
Two graphs are isomorphic if and only if for some ordering of their
vertices their adjacency matrices are equal.
c
3
b e
2 4
a f 1 5
During the eighteenth century the city of Königsberg (in East Prus-
sia)1 was divided into four sections, including the island of Kneiphop,
by the Pregel river. Seven bridges connected the regions, as shown in
figure 7.11. It was said that residents spent their Sunday walks trying
to find a way to walk about the city so as to cross each bridge exactly
once and then return to the starting point. The first person to solve
the problem (in the negative) was the Swiss mathematician Leonhard
Euler in 1736. He represented the sections of the city and the seven
bridges by the graph of figure 7.12, and proved that it is impossible to
find a path in it that transverses every edge of the graph exactly once.
In the next section we study why this is so.
1The city is currently called Kaliningrad and is part of the Russian republic.
7.3. PATHS AND CIRCUITS 92
Boolean Algebras
x1
OR GATE x1 + x2
x2
x1
AND GATE x1 x2
x2
NOT GATE x x
x1 x2 x1 + x2
1 1 1
1 0 1
0 1 1
0 0 0
OR GATE
122
9.1. COMBINATORIAL CIRCUITS 123
x1 x2 x1 · x2
1 1 1
1 0 0
0 1 0
0 0 0
AND GATE
x x
1 0
0 1
NOT GATE
x1
x2 y
x3
x1 x2 x3 y = (x1 + x2 ) · x3
1 1 1 0
1 1 0 1
1 0 1 0
1 0 0 1
0 1 1 0
0 1 0 1
0 0 1 1
0 0 0 1
stays so even after x2 goes back to its original value 0. That way we
can store a bit. We can “delete” it by switching input x1 to 0.
x1
x2
1. Associative
(a + b) + c = a + (b + c)
(a · b) · c = a · (b · c)
2. Commutative
a+b=b+a
a·b=b·a
3. Distributive
a · (b + c) = (a · b) + (a · c)
a + (b · c) = (a + b) · (a + c)
4. Identity
a+0=a
a·1=a
5. Complement
a+a=1
a·a=0
x y x+y x·y
1 1 0 0
1 0 0 0
0 1 0 0
0 0 1 1
1. Associative
(x ∨ y) ∨ z = x ∨ (y ∨ z)
(x ∧ y) ∨ z = x ∧ (y ∧ z)
2. Commutative
x∨y =y∨x
x∧y =y∧x
3. Distributive
x ∧ (y ∨ z) = (x ∧ y) ∨ (x ∧ z)
x ∨ (y ∧ z) = (x ∨ y) ∧ (x ∨ z)
4. Identity
x∨0=x
x∧1=x
5. Complement
x∨x=1
x∧x=0