COMP 2711H: Lecture 13
Date: 2024-09-30 18:01:10
Reviewed:
Topic / Chapter:
summary
❓Questions
Notes
Trees
-
Leaves
- recall: tree = connected graph w/ edges
- leaf: a vertex of degree 1
- theorem: every tree on vertices: w/ at least 2 leaves
- proof: based on maximum path
- let : longest path
- claim: : leaves
- proof by contradiction: : not a leaf
- : cannot be connected to vertex in the same path
- as it won't be a cycle
- also: it cannot be connect to another vertex
- as it is against statement: is the longest path
- : cannot be connected to vertex in the same path
- w/ , how many graphs exist?
- 2 choices (yes / no) for total of possibilities
- or: largest set of size , and all (distinct) subset of it
- how many of above are trees?
- solution:
- translate all trees into seq. of length
- translation
- for each leaf (or: w/ min. neighbors) of tree: write its neighbor, and erase the leaf
- repeat until only one edge remains
- e.g.
graph LR
1((1))
2((2))
3((3))
4((4))
5((5))
6((6))
7((7))
3-->1
3-->5
1-->4
5-->6
5-->2
5-->7
- gets translated into `5 1 3 5 5`, vertex <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8389em;vertical-align:-0.1944em;"></span><span class="mord">5</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">7</span></span></span></span> remaining
- recovery
- if a node is originally a leaf: it won't be on a list
- i.e. 2, 4, 6
- choose a remaining one, and connect with existing node
- if a node is originally a leaf: it won't be on a list
graph LR
5((5))
7((7))
7-->5
6_2((6))
5_2((5))
7_2((7))
7_2-->5_2
6_2-->5_2
6_3((6))
5_3((5))
7_3((7))
4_3((4))
7_3-->5_3
6_3-->5_3
4_3-->5_3
6_4((6))
5_4((5))
7_4((7))
4_4((4))
2_4((2))
3_4((3))
7_4-->5_4
6_4-->5_4
4_4-->5_4
2_4-->3_4
6_5((6))
5_5((5))
7_5((7))
4_5((4))
2_5((2))
3_5((3))
1_5((1))
7_5-->5_5
6_5-->5_5
4_5-->5_5
2_5-->3_5
3_5-->1_5
- forest: graph consisted of forest
- HW: show how many forests are in all possible cases
- theorem: every connected graph w/ vertices: w/ at least non-cut vertices
- proof: w/ longest path
- even if are to be cut: its neighbors can still more
- same for
- theorem: every odd closed walk: contains an odd cycle
-
- if it is a cycle: problem solution
- or else:
- graph: gets divided into two smaller cycle, around
- and choose an odd graph, and work on it
- as it is only subgraph of original graph, its size must
- Bipartite graph:
- (disjoint)
- s.t. every edge: has endpoint in , another in
- theorem: is bipartite iff it has no odd cycles
- proof
- bipartite -> no odd cycles
- start in
- taking 1 edge: goes to opposite side
- taking odd no. of edge: goes to opposite side from starting side
- i.e. cannot form a cycle, as
- no cycles!
- no odd cycles -> bipartite
- put a vertex in
- add all its neighbor in , opposite side
- add all their neighbor in , opposite side
- ... repeat
- there can't be an edge within the same party
- as that would create an odd cycle
- bipartite -> no odd cycles
- theorem: assume a , then has a cycle
- proof
- let : a longest path
- : must be connected to somewhere
- i.e. within the path -> creating a cycle
- or: outside the path -> against the claim that is the longest path
- theorem: in finite ,
- every cc of : either a cycle or path
- pick an arbitrary
- let be entire graph
- for to create a cycle
- cannot connect to vertex in the middle:
- cannot connect to : it's a cycle
- if you stuck in a dead end: iterate through the opposite direction ()
- as the graph is finite, we can reach the end
- and apply the same rule described above
- 👨🏫 continue until this process covers your entire graph
- 👨🎓 a non-cycle non-path graph: must have at least 3 neighbors