1
00:00:02,614 --> 00:00:04,530
ALBERT MEYER: The topic
for this video lecture

2
00:00:04,530 --> 00:00:07,352
is Connected Vertices,
the kind of connections

3
00:00:07,352 --> 00:00:09,560
we can have between different
vertices through edges.

4
00:00:15,180 --> 00:00:17,430
We're going to start by
showing that the shortest walk

5
00:00:17,430 --> 00:00:20,680
between two vertices is a path.

6
00:00:20,680 --> 00:00:23,460
We're going to prove
it by contradiction.

7
00:00:23,460 --> 00:00:25,640
Suppose we have some
path from u to v

8
00:00:25,640 --> 00:00:28,740
and it crosses over itself.

9
00:00:28,740 --> 00:00:33,560
So here we have u and v. At
some point, you get to c,

10
00:00:33,560 --> 00:00:36,490
and you go back to c, and
from there you go to v.

11
00:00:36,490 --> 00:00:39,970
So you've gone through
some vertice twice.

12
00:00:39,970 --> 00:00:42,570
But if you want to get
the shortest path from u

13
00:00:42,570 --> 00:00:45,780
to v, why would you
go through this loop?

14
00:00:45,780 --> 00:00:49,620
Why not just keep going
straight from c to v?

15
00:00:49,620 --> 00:00:55,210
The path without that section
that goes from c back to itself

16
00:00:55,210 --> 00:00:57,280
also for u to v and is shorter.

17
00:00:57,280 --> 00:00:59,520
So if we have any path
that crosses over itself,

18
00:00:59,520 --> 00:01:02,580
we can just get rid of
that part that loops around

19
00:01:02,580 --> 00:01:07,320
back into itself, and we
still have a walk from u to v.

20
00:01:07,320 --> 00:01:09,300
So therefore the
shortest walk from u to v

21
00:01:09,300 --> 00:01:10,220
is going to be a path.

22
00:01:12,970 --> 00:01:15,270
Now we're going to talk
about the length and the walk

23
00:01:15,270 --> 00:01:16,100
relation.

24
00:01:16,100 --> 00:01:19,330
What this means is with
two vertices, v and w,

25
00:01:19,330 --> 00:01:22,530
there is this Gn
relation between v and w

26
00:01:22,530 --> 00:01:28,280
if there exists a length
n walk from v to w.

27
00:01:28,280 --> 00:01:32,430
Gn is called the length
n walk relation for G.

28
00:01:32,430 --> 00:01:34,410
So basically, if
you can find a way

29
00:01:34,410 --> 00:01:38,850
to go from v to w in
exactly n steps, then

30
00:01:38,850 --> 00:01:43,640
Gn applies from v to w.

31
00:01:43,640 --> 00:01:46,300
G itself, when you think
about it, is a length 1

32
00:01:46,300 --> 00:01:48,040
walk relation.

33
00:01:48,040 --> 00:01:50,900
The graphs define
these relations.

34
00:01:50,900 --> 00:01:53,700
There is an edge from
one vertice to another

35
00:01:53,700 --> 00:01:56,530
if there is a length 1 edge
from one vertice to another.

36
00:01:56,530 --> 00:01:59,460
It is itself.

37
00:01:59,460 --> 00:02:04,190
Now, this lemma-- they say that
Gm and relational composition

38
00:02:04,190 --> 00:02:06,070
with Gn equals Gm plus n.

39
00:02:06,070 --> 00:02:08,190
Let's explain with this means.

40
00:02:08,190 --> 00:02:10,330
So what that relational
composition means

41
00:02:10,330 --> 00:02:13,970
is that the relational
composition between the two

42
00:02:13,970 --> 00:02:16,970
applies from x to y if
there is some vertice,

43
00:02:16,970 --> 00:02:21,400
z, such that there is
a path, n, from x to z,

44
00:02:21,400 --> 00:02:25,040
and then a path, n, from z to y.

45
00:02:25,040 --> 00:02:28,700
Gm applies from x to z and
Gn applies from z to y.

46
00:02:28,700 --> 00:02:33,740
And this is why this is the same
thing as Gm plus n makes sense.

47
00:02:33,740 --> 00:02:37,180
If there is a path length
n to z and a path length

48
00:02:37,180 --> 00:02:40,320
n from there to y, you just
go from x to z in m steps,

49
00:02:40,320 --> 00:02:41,650
then z to y in n steps.

50
00:02:41,650 --> 00:02:44,028
And you have m plus
n steps from x to y.

51
00:02:46,760 --> 00:02:50,970
The length 0 walk
relation just make

52
00:02:50,970 --> 00:02:52,800
each vertice go back to itself.

53
00:02:52,800 --> 00:02:57,110
It points back to itself,
the individual one.

54
00:02:57,110 --> 00:02:59,244
And the lemma is still true.

55
00:02:59,244 --> 00:03:04,310
G0 composes with Gn is
just Gn, which makes sense.

56
00:03:04,310 --> 00:03:07,910
Everything itself plus
Gn just gives you Gn.

57
00:03:10,740 --> 00:03:12,760
Let's talk about
composition of matrices.

58
00:03:12,760 --> 00:03:16,600
So if we have some
adjacency matrix for G

59
00:03:16,600 --> 00:03:20,540
and we do a
composition with sum h,

60
00:03:20,540 --> 00:03:23,980
then we can get that by applying
this Boolean and/or matrix

61
00:03:23,980 --> 00:03:25,940
multiplication.

62
00:03:25,940 --> 00:03:27,870
These adjacency matrices
are ones and zeros.

63
00:03:27,870 --> 00:03:30,775
So we do matrix multiplication,
but with Boolean operations

64
00:03:30,775 --> 00:03:32,400
instead of plusses
and multiplications.

65
00:03:35,070 --> 00:03:40,250
So we can compute A G of n by
fast matrix exponentiation.

66
00:03:40,250 --> 00:03:41,820
How do we do that?

67
00:03:41,820 --> 00:03:47,200
Well, basically you can do
it for G n over 2 twice,

68
00:03:47,200 --> 00:03:49,290
and then Gn over f
for each of those

69
00:03:49,290 --> 00:03:53,303
twice, and go doing those
Boolean operations on each.

70
00:03:53,303 --> 00:03:57,250
So A G of n equals
A G of n over 2,

71
00:03:57,250 --> 00:04:01,410
applying this operator
to A G n over 2.

72
00:04:01,410 --> 00:04:03,750
So you can just break
it down in 2 each time

73
00:04:03,750 --> 00:04:09,290
so you get logarithmic number
of problems that we have to do.

74
00:04:09,290 --> 00:04:11,230
Now let's define
another relation.

75
00:04:11,230 --> 00:04:17,300
G star is just called the
walk relation of G. Basically,

76
00:04:17,300 --> 00:04:19,904
G star applies from u to v
if there is a walk from u

77
00:04:19,904 --> 00:04:21,470
to v, no matter how long it is.

78
00:04:21,470 --> 00:04:24,822
If you can find some way to get
from u to v, then it applies.

79
00:04:28,070 --> 00:04:30,240
If you want to get
the walk relation,

80
00:04:30,240 --> 00:04:34,790
you just get everything inside
the graph and apply self-loops.

81
00:04:34,790 --> 00:04:38,930
So add in an edge that
points back to itself

82
00:04:38,930 --> 00:04:41,020
for every vertice.

83
00:04:41,020 --> 00:04:43,500
We called this G less
than or equal to.

84
00:04:43,500 --> 00:04:50,760
It's basically G and then
add in these G0 self edges.

85
00:04:50,760 --> 00:04:53,180
And G less than or
equal to has a length n

86
00:04:53,180 --> 00:04:58,160
walk if G has a less
than or equal to n walk.

87
00:04:58,160 --> 00:04:59,380
Now, think about that.

88
00:04:59,380 --> 00:05:03,430
If I can get from
vertice x to vertice y

89
00:05:03,430 --> 00:05:08,400
in n minus some
amount of steps in G,

90
00:05:08,400 --> 00:05:11,144
then I can get there in
n steps in G less than

91
00:05:11,144 --> 00:05:14,611
or equal to because I
can just loop around.

92
00:05:14,611 --> 00:05:17,480
If I want to get here
from red to blue,

93
00:05:17,480 --> 00:05:21,050
I can get there in one step
without those self-loops.

94
00:05:21,050 --> 00:05:23,833
But with the self-loops, I can
just keep starting from red

95
00:05:23,833 --> 00:05:26,200
and go around to red as
many times as I want,

96
00:05:26,200 --> 00:05:29,010
n minus 1 times, and
then do this final step.

97
00:05:29,010 --> 00:05:34,110
So I can make a length
n walk for any value

98
00:05:34,110 --> 00:05:35,072
of n greater than 1.

99
00:05:38,690 --> 00:05:40,800
Now let's compute
the walk relation

100
00:05:40,800 --> 00:05:42,840
using what we've just defined.

101
00:05:42,840 --> 00:05:44,710
So G has n vertices.

102
00:05:44,710 --> 00:05:49,350
So the length of paths are going
to be less than or equal to n.

103
00:05:49,350 --> 00:05:52,820
If you just go in a straight
line from one thing to another,

104
00:05:52,820 --> 00:05:54,600
passing through each
possible vertice,

105
00:05:54,600 --> 00:05:57,520
at most you're going to
get n minus one length.

106
00:05:57,520 --> 00:05:59,520
Because you're going to
pass through n vertices,

107
00:05:59,520 --> 00:06:01,740
so there's n minus 1 edge
that's connected there.

108
00:06:01,740 --> 00:06:06,280
So G star, which is
just the relation

109
00:06:06,280 --> 00:06:10,125
if there is a walk from u to v,
is going to be this G less than

110
00:06:10,125 --> 00:06:12,960
or equal to n minus 1.

111
00:06:12,960 --> 00:06:15,190
So if we get G less
than or equal to,

112
00:06:15,190 --> 00:06:17,740
add in all these
self-loops, and then find

113
00:06:17,740 --> 00:06:19,950
all of the paths
of length n minus 1

114
00:06:19,950 --> 00:06:26,270
in there, which is
basically all paths since G

115
00:06:26,270 --> 00:06:29,305
less than equal to n minus 1
is all paths less than or equal

116
00:06:29,305 --> 00:06:30,510
to n minus 1.

117
00:06:30,510 --> 00:06:32,970
But since G only
has paths of less

118
00:06:32,970 --> 00:06:35,985
than or equal to n minus 1,
that's just all the paths.

119
00:06:35,985 --> 00:06:38,720
It's just every single
one of the vertices.

120
00:06:38,720 --> 00:06:40,550
And so we've defined
G star and that's

121
00:06:40,550 --> 00:06:42,790
how we get all
connected vertice pairs.

122
00:06:42,790 --> 00:06:45,270
And we can do this
in n squared log n

123
00:06:45,270 --> 00:06:51,370
time using that composition
of the adjacency matrices.