Sei sulla pagina 1di 73

Review from pervious class:

04/01/17 1
04/01/17 2
04/01/17 3
Today's Class

Graph Isomorphism
Path
Connectivity

04/01/17 4
04/01/17 5
04/01/17 6
04/01/17 7
04/01/17 8
04/01/17 9
04/01/17 10
EXAMPLE

In the simple graph shown in Figure , a , d, c, f, e is a simple path


of length 4, because {a , d}, {d, c } , {c, f}, and { f, e} are all
edges.
However, d, e, c, a is not a path, because {e, c} is not an edge.
Note that b, c, f, e, b is a circuit of length 4 because {b, c}, {c, f},
{f, e}, and {e, b} are edges, and this path begins and ends at b.
The path a, b, e, d, a, b, which is of length 5, is not simple
because it contains the edge {a, b} twice.

04/01/17 11
04/01/17 12
Example

Figure: The Graphs G 1 and G2

The graph G l in Figure is connected, because for every pair


of distinct vertices there is a path between them.

However, the graph G 2 in Figure 2 is not connected. For


instance, there is no path in G2 between vertices a and d.

04/01/17 13
Connectivity

Q: Which of the following graphs are connected?

1 2

3
4

04/01/17 14
Connectivity

A: First and second are disconnected. Last is connected.

1 2

3
4

04/01/17 15
Connected Components

A: The components are {1,3,5},{2,4,6},{7} and {8} as


one can see visually by pulling components apart:

1
6 2

8 7
5 3
4

04/01/17 16
04/01/17 17
EXAMPLE: Are the directed graphs G and H shown in
Figure strongly connected? Are they weakly
connected?
H is strongly connected
weakly strongly
because there is a path
Connected connected between any two vertices
in this directed graph.
Hence, H is also weakly
connected.

The graph G is not


G H strongly connected. There
is no directed path from a
vertex to other vertex in
this graph.
04/01/17 18
There are several ways that paths and circuits can
help determine whether two graphs are isomorphic:

So we can add the following point to the slide#7:


paths can be used to construct mappings that may
be isomorphism.
04/01/17 19
Graph Isomorphism:-Example

Prove that the graph K is isomorphic to


graph R .

K R

1. First label the vertices:


2 2
1 3 1 3

5 4
5 4
04/01/17 20
Graph Isomorphism
-Example

2. Next, set f (1) = 1 and try to walk around


clockwise on the star.

2 2
1 3 1 3

5 4
5 4

04/01/17 21
Graph Isomorphism
-Example

3. Next, set f (1) = 1 and try to walk around


clockwise on the star. The next vertex seen is 3,
not 2 so set f (2) = 3.

2 2
1 3 1 3
5 4
5 4

04/01/17 22
Graph Isomorphism
-Example

4. Next, set f (1) = 1 and try to walk around


clockwise on the star. The next vertex seen is 3,
not 2 so set f (2) = 3. Next vertex is 5 so set f (3)
= 5.

2 2
1 3 1 3
5 4
5 4

04/01/17 23
Graph Isomorphism
-Example

5. Next, set f (1) = 1 and try to walk around


clockwise on the star. The next vertex seen is 3,
not 2 so set f (2) = 3. Next vertex is 5 so set f (3)
= 5. In this fashion we get f (4) = 2

2 2
1 3 1 3
5
4 5 4

04/01/17 24
Graph Isomorphism
-Example

6. Next, set f (1) = 1 and try to walk around


clockwise on the star. The next vertex seen is 3,
not 2 so set f (2) = 3. Next vertex is 5 so set f (3)
= 5. In this fashion we get f (4) = 2, f (5) = 4.

2 2
1 3 1 3

5 4 5 4

04/01/17 25
Graph Isomorphism
-Example

7. Next, set f (1) = 1 and try to walk around clockwise


on the star. The next vertex seen is 3, not 2 so set f
(2) = 3. Next vertex is 5 so set f (3) = 5. In this
fashion we get f (4) = 2, f (5) = 4. If we would
continue, we would get back to f (1) =1 so this
process is well defined and f is a morphism.
2 2
1 3 1 3

5 4
5 4

04/01/17 26
Example: Determine whether the graphs G and H shown
in Figure are isomorphic.

04/01/17 27
Solution:
Both G and H have six vertices and eight edges.

Each has four vertices of degree three, and two vertices of


degree two.
all agree for the two graphs G and H.

However, H has a simple circuit of length three, namely,


v1, v2, v6, v1, whereas G has no simple circuit of length
three, as can be determined by inspection (all simple
circuits in G have length at least four).

Because the existence of a simple circuit of length three is


an isomorphic invariant, G and H are not isomorphic.

04/01/17 28
Example: Determine whether the graphs G and H shown
in Figure are isomorphic.

04/01/17 29
Solution:

Both G and H have five vertices and six edges.


Each has two vertices of degree three, and three
vertices of degree two.
Both have a simple circuit of length three, a
simple circuit of length four, and a simple circuit
of length five.
Because all these isomorphic invariants agree
here, so G and H may be isomorphic.
..continued to next slide
04/01/17 30
Finding of possible isomorphism:
. we will follow paths that go through all vertices so that the
corresponding vertices in the two graphs have the same degree.
For example, the paths u1, u4,u3, u2, u5 in G and v3, v2, v1, v5,
v4 in H both go through every vertex in the graph; start at a
vertex of degree three; go through vertices of degrees two, three,
and two, respectively; and end at a vertex of degree two.

By following these paths through the graphs, we can define the


mapping f with
f (u1) = v3, f (u4) = v2, f (u3) = v1,
f (u2) = v5, and f (u5) = v4.

It show that f is an isomorphism, so G and H are


isomorphic.

04/01/17 31
Consider digraph adjacency matrix:

1 0 1 0

1. Find a path from a to d.
0 1 0 1
1 1 0 0
1. Is there a path from d to a?
0 1 0 0

04/01/17 32
Paths in Directed Graphs

Answer: a b c d
1 0
a
0 1

b
0 1 0 1
1 1 0 0
c


0 1 0 0

d

1. acbd.

2. Theres no path from d to a. From d must go to b, from


b must stay at b or return to d. In other words b and d
are disconnected from a.

04/01/17 33
Today's Class

Chapter 9, Sec 9.5

Euler and Hamilton Cycles


Euler circuits and paths:

Euler circuit:
An Euler circuit in a graph G is a simple
circuit containing every edge of G.

Euler path:
An Euler path in G is a simple path
containing every edge of G.

04/01/17 35
Which of the following graphs are Euler
path or circuit?

04/01/17 36
EXAMPLE: Which of the undirected graphs in Figure (s37)
have an Euler circuit? Of those that do not,
which have an Euler path?
Solution:

The graph G1 has an Euler circuit, for


example, a, e, c, d, e, b, a.
Neither of the graphs G2 or G3 has an
Euler circuit.
However, G3 has an Euler path, namely,
a, c, d, e, b, d, a, b. G2 does not have
an Euler path.

04/01/17 37
04/01/17 38
Which graphs shown in Figure 7 have an Euler path?

04/01/17 39
Solution:
G1 contains exactly two vertices of odd degree,
namely, b and d. Hence, it has an Euler path that
must have b and d as its endpoints.

One such Euler path is d, a, b, c, d, b.

Similarly,G2 has exactly two vertices of odd


degree, namely, b and d. So it has an Euler path
that must have b and d as endpoints.

One such Euler path is b, a, g, f, e, d, c, g, b, c, f, d.

G3 has no Euler path because it has six vertices of


odd degree.

04/01/17 40
Which of the following directed graphs have an Euler circuit?
Of those that do not, which have an Euler path?

The graph H2 has an Euler circuit, for example, a, g, c, b, g,


e, d, f, a.
Neither H1nor H3 has an Euler circuit.
H3 has an Euler path, namely, c, a, b, c, d, b, but H1 does not.
04/01/17 41
04/01/17 42
04/01/17 43
04/01/17 44
Finding Euler Circuits: Mohammeds Scimitars

Many puzzles ask you to draw a picture in a continuous


motion
without lifting a pencil so that no part of the picture is
retraced.
We can solve such puzzles using Euler circuits and paths.
For
example, can Mohammed s scimitars, shown in Figure 6,
be drawn
in this way, where the drawing begins and ends at the
same point?

04/01/17 45
Finding Euler Circuits: Mohammeds Scimitars

04/01/17 46
Finding Euler Circuits
Mohammeds Scimitars
Found a cycle after starting from middle vertex.

04/01/17 47
Finding Euler Circuits
Mohammeds Scimitars
Found a cycle after starting from middle vertex.

Delete the cycle:

04/01/17 48
Finding Euler Circuits
Mohammeds Scimitars
Found a cycle after starting from middle vertex.

Delete the cycle:

04/01/17 49
Finding Euler Circuits
Mohammeds Scimitars
Found a cycle after starting from middle vertex.

Delete the cycle:

04/01/17 50
Finding Euler Circuits
Mohammeds Scimitars (home work)

Now try again (say from middle vertex):

04/01/17 51
Finding Euler Circuits
Mohammeds Scimitars

This time, found a cycle starting and ending at middle


vertex:

Amalgamate these cycles together from a point of


intersection, and delete from graph:
04/01/17 52
Finding Euler Circuits
Mohammeds Scimitars

Find another cycle from middle vertex:

04/01/17 53
Finding Euler Circuits
Mohammeds Scimitars

1
2

Find another cycle from middle vertex:

04/01/17 54
Finding Euler Circuits
Mohammeds Scimitars

1
2
3

Find another cycle from middle vertex:

04/01/17 55
Finding Euler Circuits
Mohammeds Scimitars

1
2
3 4
Find another cycle from middle vertex:

04/01/17 56
Finding Euler Circuits
Mohammeds Scimitars

1
2
3 5
4
Find another cycle from middle vertex:

04/01/17 57
Finding Euler Circuits
Mohammeds Scimitars

1
2 6
3 5
4
Find another cycle from middle vertex:

04/01/17 58
Finding Euler Circuits
Mohammeds Scimitars

7
1
2 6
3 5
4
Find another cycle from middle vertex:

04/01/17 59
Finding Euler Circuits
Mohammeds Scimitars

8
7
1
2 6
3 5
4
Find another cycle from middle vertex:

04/01/17 60
Finding Euler Circuits
Mohammeds Scimitars

9 8
7
1
2 6
3 5
4
Find another cycle from middle vertex:

04/01/17 61
Finding Euler Circuits
Mohammeds Scimitars

9 8
10 7
1
2 6
3 5
4
Find another cycle from middle vertex:

04/01/17 62
Finding Euler Circuits
Mohammeds Scimitars

9 8
10 7
1
2 11 6
3 5
4
Find another cycle from middle vertex:

04/01/17 63
Finding Euler Circuits
Mohammeds Scimitars

9 8
10 7
1
2 11 6
3 5
4
Amalgamate it to Euler cycle of deleted graph, and delete
it. Need to insert cycle between former edges 10 &
11:

04/01/17 64
Finding Euler Circuits
Mohammeds Scimitars

Finally, need to add the triangle.


9 8
10 7
1
2 ?? 6
3 5
4

Use same nave approach looking for cycle in


remaining component:

04/01/17 65
Finding Euler Circuits
Mohammeds Scimitars

Finally, need to add the triangle.


9 8
10 7
1 11
2 ?? 6
3 5
4

Use same nave approach looking for cycle in


remaining component:

04/01/17 66
Finding Euler Circuits
Mohammeds Scimitars

Finally, need to add the triangle.


9 8
10 7
1 12
2 ?? 11 6
3 5
4

Use same nave approach looking for cycle in


remaining component:

04/01/17 67
Finding Euler Circuits
Mohammeds Scimitars

Finally, need to add the triangle.


9 8
10 13 7
1 12
2 ?? 11 6
3 5
4

Use same nave approach looking for cycle in


remaining component:

04/01/17 68
Finding Euler Circuits
Mohammeds Scimitars

Finally, need to add the triangle.


9 8
10 14 13 7
1 12
2 ?? 11 6
3 5
4

Use same nave approach looking for cycle in


remaining component:

04/01/17 69
Finding Euler Circuits
Mohammeds Scimitars

Finally, need to add the triangle.


9 8
10 14 13 7
1 12
2 15 11 6
3 5
4

Use same nave approach looking for cycle in


remaining component:

04/01/17 70
Finding Euler Circuits
Mohammeds Scimitars

9 8
10 14 13 7
1 12
2 15 11 6
3 5
4

Amalgamate the triangle cycle between edges


formerly labeled 9 & 10:

04/01/17 71
Finding Euler Circuits
Mohammeds Scimitars

9 8
?? ?? ?? 7
1 ??
2 ?? ?? 6
3 5
4

Amalgamate the triangle cycle between edges


formerly labeled 9 & 10:

04/01/17 72
Finding Euler Circuits
Mohammeds Scimitars

We found the Euler circuit!


9
10 8
11 12 13 17 16 7
1 15
2 18 14 6
3 5
4

04/01/17 73

Potrebbero piacerti anche