M61 - Graph theory

M61 - Graph theory
• The final is cumulative, but with emphasis on the Midterm II material and graph theory.
• This sheet is for the relevant graph theory material in the final. For the Midterm material, please
use Midterm question papers, reviews and HWs as a study guide
8.1-8.2 : Graphs, paths and cycles
Theory
(a) Definitions of graphs (simple, undirected, directed, weighted, complete, bipartite).
(b) Definitions of degree of a vertex, path, cycle, simple path, simple cycle, Euler cycle*1 .
(c) Theorem statements :
•
•
•
•
The sum of the degrees of all vertices is twice the number of edges in a graph.
If G has an Euler cycle, then it is connected and every vertex has even degree
If G is connected and every vertex has even degree, then G has an Euler cycle.
A connected graph G is bipartite if and only if it has no odd length cycles.
Practice questions
• How many edges in complete graph Km ? When does it contain an Euler cycle ?
• How many edges in complete bipartite graph Km,n ? When does it contain an Euler cycle ?
• Does a simple graph on 6 vertices exist with vertices having degree 1, 2, 3, 4, 5, 5. If so draw
it. If not, explain why
• Does a simple graph with 4 vertices and 4 edges exist with vertices having degree 1, 2, 3, 4.
If so draw it. If not, explain why
• Does a simple graph with 4 vertices exist with vertices having degree 1, 1, 1, 1. If so draw it.
If not, explain why
• Does a simple graph with 5 vertices exist with vertices having degree 2, 3, 3, 4, 4. If so draw
it. If not, explain why
• If a simple graph on 5 vertices has 10 edges, describe the graph.
• G is a graph whose vertices are labelled with distinct 3 bit strings. Two vertices are joined
by an edge if the labels of the vertices differ by exactly one bit. (Ex 8.1.8). Is G bipartite ?
• *How many paths of length k in Kn (k ≥ 1)
• *(Problem 66 in Section 8.2) - How many simple paths between two distinct vertices v and
w in Kn ?
1
A cycle that includes all edges and all vertices of a graph
1
8.4 - Shortest path algorithm
Theory : Know how to implement Dijkstra’s shortest path algorithm on a weighted graph to find both
the length of the shortest path and the shortest path itself.
Practice questions : Exercises 1 & 4 in Section 8.4
8.5 - Representation of graphs
Theory
(a) What is an adjacency matrix (of an undirected graph) ? Why is it symmetric ?
(b) The sum of row/column i in the matrix represents the degree of the i-th vertex.
(c) Theorem statement : If A is the adjacency matrix of a simple graph, the ijth entry of An is
equal to the number of paths from vertex i to vertex j of length n.
Practice questions
• Write down the adjacency matrix for K4 and K2,3 .
• Draw the undirected graph corresponding to the 4 × 4 matrix (aij ) with entries aij = 1 if
i + j is even and 0 if not.
• How many paths of length 2 in K3 (vertices are v1 , v2 , v3 ) between vertex v1 and v3 ?
• *Exercises 21, 27 in Section 8.5
8.6 - Isomorphisms of graphs
Theory : What is an isomorphism of graphs ? Use some invariants to determine when two graphs are
not isomorphic.
Practice questions : Exercises 7-9 in Section 8.6
9.1-9.2 - Trees
Definitions : Parents, sibling, descendants, children, ancestors.
Theorem with proof ! : Theorem 9.2.3 (characterizing a tree)
Practice questions : Exercises 22-26 in Section 9.2
9.3 - BFS
Theory : What is a spanning tree of a graph ? BFS algorithm
Practice questions : Exercises 1-2 in Section 9.3
2