## Graph Theory

 Question 1
Consider an undirected random graph of eight vertices. The probability that there is an edge between a pair of vertices is 1/2. What is the expected number of unordered cycles of length three?
 A 1/8 B 1 C 7 D 8
GATE CS 2013    Graph Theory
Discuss it

Question 1 Explanation:
 Question 2
Which of the following statements is/are TRUE for undirected graphs?
```P: Number of odd degree vertices is even.
Q: Sum of degrees of all vertices is even. ```
 A P only B Q only C Both P and Q D Neither P nor Q
GATE CS 2013    Graph Theory
Discuss it

Question 2 Explanation:
 Question 3
The line graph L(G) of a simple graph G is defined as follows: · There is exactly one vertex v(e) in L(G) for each edge e in G. · For any two edges e and e' in G, L(G) has an edge between v(e) and v(e'), if and only if e and e'are incident with the same vertex in G. Which of the following statements is/are TRUE?
```(P) The line graph of a cycle is a cycle.
(Q) The line graph of a clique is a clique.
(R) The line graph of a planar graph is planar.
(S) The line graph of a tree is a tree. ```
 A P only B P and R only C R only D P, Q and S only
GATE CS 2013    Graph Theory
Discuss it

Question 3 Explanation:
 Question 4
Let G be a simple undirected planar graph on 10 vertices with 15 edges. If G is a connected graph, then the number of bounded faces in any embedding of G on the plane is equal to
 A 3 B 4 C 5 D 6
GATE CS 2012    Graph Theory
Discuss it

Question 4 Explanation:
If the graph is planar, then it must follow below Euler's Formula for planar graphs
```v - e + f = 2
v is number of vertices
e is number of edges
f is number of faces including bounded and unbounded

10 - 15 + f = 2
f = 7
There is always one unbounded face, so the number of bounded faces =  6```
 Question 5
Which of the following graphs is isomorphic to
 A A B B C C D D
GATE CS 2012    Graph Theory
Discuss it

Question 5 Explanation:
 Question 6
Let G be a complete undirected graph on 6 vertices. If vertices of G are labeled, then the number of distinct cycles of length 4 in G is equal to
 A 15 B 30 C 45 D 360
GATE CS 2012    Graph Theory
Discuss it

Question 6 Explanation:
There can be total 6C4 ways to pick 4 vertices from 6. The value of 6C4 is 15. Note that the given graph is complete so any 4 vertices can form a cycle. There can be 6 different cycle with 4 vertices. For example, consider 4 vertices as a, b, c and d. The three distinct cycles are cycles should be like this (a, b, c, d,a) (a, b, d, c,a) (a, c, b, d,a) (a, c, d, b,a) (a, d, b, c,a) (a, d, c, b,a) and (a, b, c, d,a) and (a, d, c, b,a) (a, b, d, c,a) and (a, c, d, b,a) (a, c, b, d,a) and (a, d, b, c,a) are same cycles. So total number of distinct cycles is (15*3) = 45. **NOTE**: In original GATE question paper 45 was not an option. In place of 45, there was 90.
 Question 7
 A K4 is planar while Q3 is not B Both K4 and Q3 are planar C Q3 is planar while K4 is not D Neither K4 nor Q3 are planar
GATE CS 2011    Graph Theory
Discuss it

Question 7 Explanation:
A Graph is said to be planar if it can be drawn in a plane without any edges crossing each other. Following are planar embedding of the given two graphs (Source: http://clweb.csa.iisc.ernet.in/rahulsharma/gate2011key.html)
 Question 8
Let G = (V,E) be a graph. Define ξ(G) = Σd id x d, where id is the number of vertices of degree d in G. If S and T are two different trees with ξ(S) = ξ(T),then
 A |S| = 2|T| B |S| = |T|-1 C |S| = |T| D |S| = |T|+1
GATE CS 2010    Graph Theory
Discuss it

Question 8 Explanation:
The expression ξ(G) is basically sum of all degrees in a tree.   For example, in the following tree, the sum is 3 + 1 + 1 + 1.
```    a
/ | \
b  c  d```
Now the questions is, if sum of degrees in trees are same, then what is the relationship between number of vertices present in both trees? The answer is, ξ(G) and ξ(T) is same for two trees, then the trees have same number of vertices. It can be proved by induction. Let it be true for n vertices. If we add a vertex, then the new vertex (if it is not the first node) increases degree by 2, it doesn't matter where we add it. For example, try to add a new vertex say 'e' at different places in above example tee.
 Question 9
The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in decreasing order. Which of the following sequences can not be the degree sequence of any graph?
```I. 7, 6, 5, 4, 4, 3, 2, 1
II. 6, 6, 6, 6, 3, 3, 2, 2
III. 7, 6, 6, 4, 4, 3, 2, 2
IV. 8, 7, 7, 6, 4, 2, 1, 1 ```
 A I and II B III and IV C IV only D II and IV
GATE CS 2010    Graph Theory
Discuss it

Question 9 Explanation:
A generic algorithm or method to solve this question is 1: procedure isV alidDegreeSequence(L) 2: for n in list L do 3: if L doesn’t have n elements next to the current one then return false 4: decrement next n elements of the list by 1 5: arrange it back as a degree sequence, i.e. in descending order 6: if any element of the list becomes negative then return false 7: return true Rationale behind this method comes from the properties of simple graph. Enumerating the f alse returns, 1) if L doesn’t have enough elements after the current one or 2) if any element of the list becomes negative, then it means that there aren’t enough nodes to accommodate edges in a simple graph fashion, which will lead to violation of either of the two conditions of the simple graph (no self-loops and no multiple-edges between two nodes), if not others. See http://www.geeksforgeeks.org/data-structures-and-algorithms-set-25/ This solution is contributed by Vineet Purswani. Another one: A degree sequence d1,d2,d2. . . dn of non negative integer is graphical if it is a degree sequence of a graph. We now introduce a powerful tool to determine whether a particular sequence is graphical due to Havel and Hakimi Havel–Hakimi Theorem : → According to this theorem, Let D be sequence the d1,d2,d2. . . dn with d1 ≥ d2 ≥ d2 ≥ . . . dn for n≥ 2 and di ≥ 0. → Then D0 be the sequence obtained by: → Discarding d1, and → Subtracting 1 from each of the next d1 entries of D. → That is Degree sequence D0 would be : d2-1, d2-1, d3-1 . . . , dd1+1 -1 . . . , dn → Then, D is graphical if and only if D0 is graphical. Now, we apply this theorem to given sequences: option I) 7,6,5,4,4,3,2,1 → 5,4,3,3,2,1,0 → 3,2,2,1,0,0 → 1,1,0,0,0 → 0,0,0,0 so its graphical. Option II) 6,6,6,6,3,3,2,2 → 5,5,5,2,2,1,2 ( arrange in ascending order) → 5,5,5,2,2,2,1 → 4,4,1,1,1,0 → 3,0,0,0,0 → 2,-1,-1,-1,0 but d (degree of a vertex) is non negative so its not a graphical. Option III) 7,6,6,4,4,3,2,2 → 5,5,3,3,2,1,1 → 4,2,2,1,1,0 → 1,1,0,0,0 → 0,0,0,0 so its graphical. Option IV) 8,7,7,6,4,2,1,1 , here degree of a vertex is 8 and total number of vertices are 8 , so it’s impossible, hence it’s not graphical. Hence only option I) and III) are graphic sequence and answer is option-D This solution is contributed by Nirmal Bharadwaj.
 Question 10
What is the chromatic number of an n-vertex simple connected graph which does not contain any odd length cycle? Assume n >= 2.
 A 2 B 3 C n-1 D n
GATE-CS-2009    Graph Theory
Discuss it

Question 10 Explanation:
The chromatic number of a graph is the smallest number of colours needed to colour the vertices of so that no two adjacent vertices share the same colour. These types of questions can be solved by substitution with different values of n. 1) n = 2 This simple graph can be coloured with 2 colours. 2) n = 3 Here, in this graph let us suppose vertex A is coloured with C1 and vertices B, C can be coloured with colour C2 => chromatic number is 2 In the same way, you can check with other values, Chromatic number is equals to 2 This solution contributed by Anil Saikrishna Devarasetty //A simple graph with no odd cycles is bipartite graph and a Bipartite graph can be colored using 2 colors (See this)
There are 43 questions to complete.

## GATE CS Corner

See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.