Cub11k's BIU Notes
Cub11k's BIU Notes
Assignments
Discrete-math
Discrete-math 1
Discrete-math 10
Discrete-math 11
Discrete-math 12
Discrete-math 2
Discrete-math 3
Discrete-math 4
Discrete-math 5
Discrete-math 6
Discrete-math 7
Discrete-math 8
Discrete-math 9
Infi-1
Infi-1 10
Infi-1 11
Infi-1 2
Infi-1 3
Infi-1 4
Infi-1 5
Infi-1 6
Infi-1 7
Infi-1 8
Infi-1 9
Linear-1
Linear-1 1
Linear-1 10
Linear-1 11
Linear-1 12
Linear-1 2
Linear-1 3
Linear-1 4
Linear-1 5
Linear-1 6
Linear-1 7
Linear-1 8
Linear-1 9
Linear-2
Linear-2 1
Lectures
Data-structures
Data-structures 1
Data-structures 2
Data-structures 3
Discrete-math
Discrete-math 10
Discrete-math 11
Discrete-math 12
Discrete-math 13
Discrete-math 14
Discrete-math 15
Discrete-math 16
Discrete-math 18
Discrete-math 19
Discrete-math 20
Discrete-math 21
Discrete-math 22
Discrete-math 23
Discrete-math 24
Discrete-math 25
Discrete-math 26
Discrete-math 3
Discrete-math 4
Discrete-math 5
Discrete-math 6
Discrete-math 7
Discrete-math 8
Discrete-math 9
Exam 2023 (2A)
Exam 2023 (2B)
Exam 2023 (A)
Exam 2023 (B)
Exam 2023 (C)
Exam 2024 (A)
Exam 2024 (B)
Exam 2024 (C)
Midterm
Infi-1
Exam 2022B (A)
Exam 2022B (B)
Exam 2023B (A)
Exam 2023B (B)
Exam 2024 (A)
Exam 2024 (B)
Exam 2025 (A)
Infi-1 10
Infi-1 12
Infi-1 13
Infi-1 14
Infi-1 15
Infi-1 16
Infi-1 17
Infi-1 19
Infi-1 20
Infi-1 21
Infi-1 22
Infi-1 23
Infi-1 24
Infi-1 25
Infi-1 26
Infi-1 5
Infi-1 6
Infi-1 7
Infi-1 9
Midterm
Theorems and proofs
Infi-2
Infi-2 1
Infi-2 10
Infi-2 11
Infi-2 12
Infi-2 13
Infi-2 14
Infi-2 15
Infi-2 16
Infi-2 17
Infi-2 2-3
Infi-2 3-4
Infi-2 5
Infi-2 6
Infi-2 7
Infi-2 8
Infi-2 9
Linear-1
Exam 2023 (B)
Exam 2023 (C)
Exam 2024 (A)
Exam 2024 (B)
Exam 2024 (C)
Exam 2025 (A)
Linear-1 11
Linear-1 12
Linear-1 13
Linear-1 4
Linear-1 5
Linear-1 6
Linear-1 7
Linear-1 8
Linear-1 9
Midterm
Random exams
Theorems and proofs
Linear-2
Linear-2 1
Linear-2 2
Linear-2 3
Linear-2 4
Linear-2 5
Linear-2 6
Linear-2 7
Linear-2 8
Seminars
CSI
CSI 2
Data-structures
Data-structures 1
Data-structures 2
Data-structures 3
Discrete-math
Discrete-math 1
Discrete-math 10
Discrete-math 11
Discrete-math 12
Discrete-math 2
Discrete-math 3
Discrete-math 4
Discrete-math 5
Discrete-math 6
Discrete-math 7
Discrete-math 8
Discrete-math 9
Infi-1
Infi-1 10
Infi-1 11
Infi-1 12
Infi-1 13
Infi-1 3
Infi-1 4
Infi-1 5
Infi-1 6
Infi-1 8
Infi-2
Infi-2 1
Infi-2 2
Infi-2 3
Infi-2 4
Infi-2 6
Infi-2 7
Infi-2 8
Linear-1
Linear-1 10
Linear-1 11
Linear-1 12
Linear-1 3
Linear-1 5
Linear-1 6
Linear-1 7
Linear-1 8
Linear-1 9
Linear-2
Linear-2 1
Linear-2 2
Linear-2 3
Linear-2 4
Linear-2 5
Linear-2 6
Linear-2 7
Templates
Lecture Template
Seminar Template
Home
Discrete-math 22
Discrete-math 22
Connected graph
#definition
Simple graph
G
=
(
V
,
E
)
Is called connected if
∀
u
,
v
∈
V
:
d
(
u
,
v
)
<
∞
⟺
d
i
a
m
(
G
)
<
∞
i.e. there is a path between any two vertices
Subgraphs of a connected graph
#lemma
Let
G
=
(
V
,
E
)
be a simple connected graph
Let
S
⊂
V
,
S
≠
∅
Then
∃
x
∈
V
∖
S
:
x
∈
Γ
(
S
)
Proof:
S
≠
∅
⟹
∃
u
∈
S
S
⊂
V
⟹
∃
v
∈
V
∖
S
G
is connected
⟹
exists a path from
u
to
v
u
=
v
1
v
=
v
k
+
1
(
v
1
,
v
2
,
v
3
,
…
,
v
k
,
v
k
+
1
)
u
∈
S
,
v
∉
S
⟹
∃
i
∈
[
1
,
k
]
:
v
i
∈
S
,
v
i
+
1
∉
S
Let
x
=
v
i
+
1
x
∈
V
⟹
x
∈
V
∖
S
v
i
∈
S
and
{
v
i
,
x
}
∈
E
⟹
x
∈
Γ
(
S
)
Properties of distance function
#lemma
d
:
V
×
V
→
N
∪
{
0
}
∪
{
∞
}
Metric
#definition
Let
u
,
v
,
w
∈
V
1.
d
(
u
,
v
)
≥
0
2.
d
(
u
,
v
)
=
0
⟺
u
=
v
3.
d
(
u
,
v
)
=
d
(
v
,
u
)
4.
d
(
u
,
v
)
+
d
(
v
,
w
)
≥
d
(
u
,
w
)
Any function that satisfies these properties
is called a metric
Relation on vertices
#definition
Let relation
∼
on
V
∀
u
,
v
∈
V
:
u
∼
v
⟺
d
(
u
,
v
)
<
∞
This relation is:
1.
Reflexive:
v
∼
v
2.
Symmetric:
u
∼
v
⟺
v
∼
u
3.
Transitive:
u
∼
v
∧
v
∼
w
⟹
u
∼
w
⟹
∼
is an equivalence relation
Let
u
∈
V
[
u
]
∼
=
{
v
∈
V
|
u
∼
v
}
=
{
v
∈
V
|
d
(
u
,
v
)
<
∞
}
Connected component
#definition
Let
G
=
(
V
,
E
)
be a simple graph
Let
u
∈
V
Connected component of
u
is a sub-graph of
G
,
denoted as
G
u
=
(
[
u
]
∼
,
E
u
)
where
E
u
=
{
{
x
,
y
}
|
x
,
y
∈
[
u
]
∼
}
V
/
∼
divides
V
into sets of vertices of graph’s connected components
Number of connected components
#definition
Let
G
=
(
V
,
E
)
be a simple graph
Let
|
V
|
=
n
,
|
E
|
=
m
Then the number of connected components is at least
n
−
m
Proof:
Base case. Let
m
=
0
⟹
There are no edges
⟹
Each vertex is a separate connected component
⟹
There are
n
components,
n
≥
n
−
m
=
n
−
0
Induction step. Let the lemma hold for
m
edges
Let
G
′
=
(
V
′
,
E
′
)
,
|
V
′
|
=
n
,
|
E
′
|
=
m
+
1
|
E
′
|
≥
1
⟹
E
′
≠
∅
Let
e
∈
E
′
G
′
∖
{
e
}
=
(
V
′
,
E
′
∖
{
e
}
)
has at least
n
−
m
connected components
Case 1.
e
connects two vertices in the same connected component of
G
′
∖
{
e
}
⟹
#
of connected components of
G
′
is also
≥
n
−
m
≥
n
−
(
m
+
1
)
Case 2.
e
connects two vertices in two different connected components
⟹
#
of connected components of
G
′
=
#
of connected components of
G
′
∖
{
e
}
−
1
meaning it is now
≥
(
n
−
m
)
−
1
=
n
−
(
m
+
1
)
⟹
Proved by Induction
Number of edges in a connected graph
#lemma
In any connected graph with
n
vertices there are at least
n
−
1
edges
Proof:
Let there be
m
<
n
−
1
edges
Then there are at least
n
−
m
>
n
−
(
n
−
1
)
=
1
connected components
⟹
Graph is not connected
−
Contradiction!
Existence of a cycle by edges number
#lemma
Let
G
=
(
V
,
E
)
be a simple graph with
n
≥
3
vertices and
m
≥
n
edges
Then
G
has a cycle
Proof:
Base case. Let
n
=
3
m
≥
n
=
3
The only possible graph with 3 vertices and 3 edges has a cycle
Induction step. Let lemma hold for
n
vertices
Let
G
′
=
(
V
′
,
E
′
)
,
|
V
′
|
=
n
+
1
,
|
E
′
|
=
m
≥
n
+
1
Let
x
∈
V
′
be a vertex with the minimal degree
Case 0.
d
e
g
(
x
)
=
0
⟹
In
G
′
∖
{
x
}
=
(
V
′
∖
{
x
}
,
E
′
)
there are
n
vertices and
m
≥
n
+
1
>
n
edges
⟹
There is a cycle in
G
′
∖
{
x
}
We didn’t remove any edges
⟹
G
′
has a cycle
Case 1.
d
e
g
(
x
)
=
1
⟹
There is no cycle containing vertex
x
⟹
G
′
∖
{
x
}
has
n
vertices and
m
−
1
≥
n
+
1
−
1
=
n
edges
⟹
G
′
∖
{
x
}
has a cycle
We didn’t remove any edges between vertices in this cycle
⟹
G
′
has a cycle
Case 2.
d
e
g
(
x
)
≥
2
⟹
Degree of any vertex in
G
′
is
≥
2
Start with some edge
{
u
,
v
}
And begin to build the path without using the same edge twice
Number of edges is finite
⟹
The process stops at some point
Let the process stop at vertex
v
k
d
e
g
(
v
k
)
≥
2
⟹
If
v
k
is a new vertex, we can continue
⟹
v
k
is not a new vertex
⟹
path
(
v
1
,
v
2
,
…
,
v
k
)
contains a sub-path from
v
k
to
v
k
⟹
There is a cycle from
v
k
to
v
k
⟹
Proved by Induction