GATE CS Short Notes
Quick revision short notes for GATE CS. 65+ chapters of concise, exam-focused content. First chapter FREE!
Chapters
Subjects
First Chapter
Quick Revision
📖 Graph Theory
Graph Theory
Overview
In the domain of Engineering Mathematics, few structures are as versatile and fundamental as the graph. A graph, in its essence, is an abstract representation of a set of objects where some pairs of the objects are connected by links. We formalise this structure as a set of vertices and a set of edges, denoted by . The applications of this simple yet powerful abstraction are ubiquitous throughout computer science, from modelling computer networks and social connections to representing state transitions in algorithms and dependencies in databases. A firm grasp of graph theory is therefore indispensable for a computer science engineer.
This chapter is designed to provide a rigorous foundation in the principles of graph theory most pertinent to the GATE examination. We begin by establishing the core terminology and formalisms, including various types of graphs and their standard representations, such as adjacency matrices and lists. We then proceed to the critical concept of connectivity, exploring paths, cycles, and components, which are essential for analysing network flow and algorithm traversal. Finally, we shall elucidate more advanced topics, namely matching and colouring, which model solutions to significant optimisation problems in resource allocation, scheduling, and register allocation. A systematic study of these topics will equip the student with the analytical reasoning and problem-solving skills necessary to excel in this section of the examination.
---
Chapter Contents
| # | Topic | What You'll Learn |
|---|-------|-------------------|
| 1 | Graph Fundamentals | Defining graphs, their types, and representations. |
| 2 | Connectivity | Analysing paths, cycles, and connected components. |
| 3 | Matching and Colouring | Exploring bipartite matching and graph colouring problems. |
---
Learning Objectives
After completing this chapter, you will be able to:
---
We now turn our attention to Graph Fundamentals...
Part 1: Graph Fundamentals
Key Definitions
For a simple graph with vertices , the adjacency matrix is an matrix where:
For an undirected graph, is symmetric ().
---
Essential Formulas
---
Must Remember
* The diagonal entry counts walks of length 2 from to itself. This is equivalent to going to a neighbor and returning, so .
* A graph is connected if and only if for every pair of distinct vertices , there is some such that .
* The graph is connected.
* The graph is acyclic.
* The graph has exactly edges.
* A necessary condition is .
* If the graph has no triangles (), the condition is stricter: .
* These are useful for quickly proving a graph is non-planar if the conditions are violated (e.g., and ).
* Complete Graph (): vertices, edges. Chromatic number .
* Cycle Graph (): vertices, edges. if is even; if is odd.
* Bipartite Graph: Can be 2-colored. A graph is bipartite if and only if it has no odd-length cycles.
---
Common Mistakes
❌ Connectivity: A graph where every vertex has a degree of at least 1 must be connected.
✅ Correct: This is false. Consider a graph consisting of two disjoint triangles. Every vertex has degree 2, but the graph is not connected.
❌ Counting 3-Cycles: The number of triangles is .
✅ Correct: The number of triangles is . The trace counts each triangle 6 times (3 starting vertices 2 directions).
❌ Euler's Formula: Using for a disconnected graph.
✅ Correct: For a graph with connected components, the formula is .
---
Quick Practice
type="MCQ" question="Let be the adjacency matrix of a simple graph . If the diagonal entries of are , what is the number of edges in ?" options=["5", "7", "14", "28"] answer="7" hint="Use the Handshaking Lemma and the relationship between and vertex degrees." solution="The diagonal entries of represent the degrees of the vertices. So, the degrees are 2, 3, 3, 2, and 4. By the Handshaking Lemma, . Therefore, .
Answer: \boxed{7}"
type="NAT" question="A simple connected planar graph has 12 vertices, and each of its faces is bounded by exactly 3 edges. Find the number of edges in the graph." answer="30" hint="Relate the number of faces and edges using the fact that each face is a triangle. Then apply Euler's formula." solution="Let be the number of edges and be the number of faces. Since each face is bounded by 3 edges and each edge is shared by exactly 2 faces, we have , or . By Euler's formula for connected planar graphs, . Substituting and , we get . This simplifies to . Thus, .
Answer: \boxed{30}"
---
Remember
> The adjacency matrix and its powers reveal deep structural properties of a graph, including connectivity, path counts, and cycle structures.See full notes for detailed explanations!
---
---
Part 2: Connectivity
Key Definitions
---
Essential Formulas
---
Must Remember
* Number of edges = Edges in + Edges for isolated vertex = .
---
Common Mistakes
❌ Error: Thinking a disconnected graph must be sparse (have very few edges).
✅ Correct: A disconnected graph can be very dense. For example, a graph with 10 vertices can have up to edges and still be disconnected. This is just one edge less than a .
---
❌ Error: Mixing up minimum and maximum bounds.
✅ Correct:
* Min edges for a connected graph: .
* Max edges for a disconnected graph: .
---
Quick Practice
type="NAT" question="What is the maximum number of cut vertices a simple connected graph with 9 vertices can have?" answer="7" hint="Consider a path graph." solution="A path graph has cut vertices (all vertices except the two endpoints). A cycle graph has 0 cut vertices. A complete graph () has 0 cut vertices. To maximize cut vertices, we need a structure like a path. A path graph has cut vertices. This is the maximum possible.
Answer: \boxed{7}"
type="MCQ" question="A simple graph has 15 vertices. Which of the following conditions guarantees that is connected?" options=["A) has 14 edges.", "B) has 90 edges.", "C) has 92 edges.", "D) Every vertex in has a degree of at least 2."] answer="C" hint="Recall the maximum number of edges a disconnected graph can have." solution="Let be the number of vertices.
A) has 14 edges. This is the minimum number of edges for a connected graph (a tree). However, a graph with 14 edges can be disconnected (e.g., a with one edge removed, and an isolated vertex). So, this does not guarantee connectivity.
B) has 90 edges. The maximum number of edges a disconnected graph with vertices can have is . For , this is . A graph with 90 edges could still be disconnected (e.g., a with one edge missing, and an isolated vertex).
C) has 92 edges. Since the maximum number of edges for a disconnected graph with 15 vertices is 91, any graph with more than 91 edges must be connected. Since , this condition guarantees that is connected.
D) Every vertex in has a degree of at least 2. This is false. Consider a graph consisting of two disjoint cycles, say and . This graph has vertices, and every vertex has degree 2. However, the graph is disconnected.
Answer: \boxed{C}"
---
Remember
> The maximum number of edges a disconnected graph with vertices can have is . Any graph with more edges than this must be connected.---
---
Part 3: Matching and Colouring
Key Definitions
A subset of edges in a graph such that no two edges in share a common vertex.
- Maximum Matching: A matching with the largest possible number of edges.
- Perfect Matching: A matching that covers every vertex of the graph. A perfect matching can only exist if is even.
---
Essential Formulas
---
Must Remember
---
Common Mistakes
❌ is always equal to .
✅ Correct: . For an odd cycle , but .
❌ The greedy algorithm finds the chromatic number.
✅ Correct: The greedy algorithm provides an upper bound on the chromatic number, i.e., colours used . It is an approximation.
❌ If , the graph must contain a subgraph.
✅ Correct: A graph can be -chromatic without containing a . For example, is 3-chromatic but has no .
---
Quick Practice
type="NAT" question="Consider the bipartite graph where , , and the edge set is . What is the size of the maximum matching in ?" answer="4" hint="Try to find a set of edges with no common vertices that covers as many vertices as possible. Can you find a perfect matching?" solution="A perfect matching exists in this graph, for example: . Since a perfect matching covers all vertices, it is necessarily a maximum matching. The size of this matching is the number of edges, which is 4.
Answer: \boxed{4}"
type="MCQ" question="Let be a simple graph with 10 vertices, , and . Which of the following statements is always true?" options=["A) contains a subgraph.", "B) The largest independent set in has size 2.", "C) G is not a planar graph.", "D) must contain an odd cycle."] answer="C" hint="Evaluate each option against the provided properties and standard theorems." solution="
A) False. We know , so . It is not guaranteed that . For example, has but .
B) False. We know . Substituting the given values, . This implies , which means . The largest independent set must have a size of at least 2, but it is not guaranteed to be exactly 2.
C) True. The Four Colour Theorem states that any planar graph is 4-colourable, i.e., . Since for this graph, it cannot be planar.
D) False. A graph with must contain an odd cycle (as otherwise it would be bipartite and ). While this statement is true, option C is a stronger, more direct conclusion from the given chromatic number. The question asks what is always true based on the information. The fact that it's not planar is a direct consequence of .
Answer: \boxed{G \text{ is not a planar graph.}}"
---
Remember
> The key to solving most colouring problems is bounding the chromatic number using cliques, independence number, and max degree: .See full notes for detailed explanations and proofs!
Chapter Summary
In this chapter, we have explored the fundamental principles of graph theory, a cornerstone of discrete mathematics and computer science. From the basic definitions of vertices and edges to the more complex properties of matching and colouring, these concepts provide a powerful framework for modelling and solving a wide array of problems. For the purpose of the GATE examination, we emphasize the following core concepts that must be thoroughly understood.
---
Chapter Review Questions
type="MCQ" question="Let be a simple, connected, planar graph with 10 vertices. It is known that the degree of each vertex is at least 3. What is the maximum possible number of edges in ?" options=["20","22","24","26"] answer="24" hint="Use the Handshaking Lemma to establish a lower bound on the number of edges. Then, use the inequality for planar graphs, , to establish an upper bound." solution="Let be the number of vertices and be the number of edges. We are given .
From the Handshaking Lemma, we have:
We are given that for all . Therefore:
This implies , or .
For a simple, connected planar graph with , we have the inequality:
Substituting , we get:
Combining our two results, we have . The maximum possible number of edges is therefore 24. This can be achieved, for instance, in an icosahedral graph which is planar, has 12 vertices, 30 edges, and is 5-regular. A planar graph with 10 vertices and 24 edges can also be constructed. Thus, the maximum possible value is 24.
Answer: \boxed{24}"
type="NAT" question="What is the chromatic number of the wheel graph (a graph with 12 vertices formed by connecting a central vertex to all vertices of a cycle)?" answer="4" hint="Consider the cycle part of the graph first. Then consider the central 'hub' vertex and its connections." solution="The wheel graph consists of a central vertex, say , connected to all 11 vertices () of a cycle .
Thus, .
Answer: \boxed{4}"
type="MSQ" question="Which of the following statements about the complete bipartite graph is/are true?" options=["A) has an Eulerian circuit.", "B) is not planar.", "C) has a perfect matching.", "D) The chromatic number of is 4."] answer="A,B" hint="Check the properties one by one: degree of vertices for Eulerian circuit, Kuratowski's theorem for planarity, Hall's condition for matching, and the definition of bipartiteness for chromatic number." solution="Let . The vertex set is partitioned into and with and .
A. Eulerian Circuit: A connected graph has an Eulerian circuit if and only if every vertex has an even degree. In , the 4 vertices in each have a degree of 6 (even). The 6 vertices in each have a degree of 4 (even). Since all vertex degrees are even and the graph is connected, has an Eulerian circuit. This statement is true.
B. Planarity: A graph is non-planar if it contains or as a minor (Kuratowski's Theorem). We can find a subgraph within . To do this, select 3 vertices from and 3 vertices from . The subgraph induced by these 6 vertices is . Since contains as a subgraph, it is not planar. This statement is true.
C. Perfect Matching: A perfect matching is a matching that covers every vertex of the graph. For a perfect matching to exist, the graph must have an even number of vertices. has vertices, which is even. However, in a bipartite graph , a perfect matching requires . Here, and . A matching can have at most edges. This matching would cover all 4 vertices in and 4 out of 6 vertices in . The remaining 2 vertices in would be unmatched. Therefore, does not have a perfect matching. This statement is false.
D. Chromatic Number: The chromatic number of any bipartite graph with at least one edge is 2. We can colour all vertices in with one colour (e.g., red) and all vertices in with a second colour (e.g., blue). No two adjacent vertices will have the same colour. Therefore, . The statement claims the chromatic number is 4. This statement is false.
The correct statements are A and B.
Answer: \boxed{A,B}"
... content continues
All Short Notes Chapters
Engineering Mathematics
Digital Logic
Computer Organization and Architecture
Programming and Data Structures
Algorithms
Theory of Computation
Compiler Design
Operating System
Databases
Computer Networks
Why Use Short Notes?
Quick Revision
Cover entire syllabus in less time
Exam Focused
Only important points and formulas
Mobile Friendly
Study on the go, anywhere
Frequently Asked Questions
What are short notes?
Short notes are condensed, exam-focused summaries covering key concepts, formulas, and important points - perfect for quick revision before exams.
Is the first chapter free?
Yes! The first chapter's short notes are completely FREE with full content. Try before upgrading.
How are short notes different from study notes?
Short notes are concise summaries for quick revision, while study notes provide detailed explanations with examples and practice problems.
Can I use short notes for last-minute revision?
Absolutely! Short notes are specifically designed for quick revision before exams, covering all key points in minimal time.
More GATECS Resources
Why Choose MastersUp?
AI-Powered Plans
Personalized study schedules based on your exam date and learning pace
15,000+ Questions
Verified questions with detailed solutions from past papers
Smart Analytics
Track your progress with subject-wise performance insights
Bookmark & Revise
Save important questions for quick revision before exams
No credit card required • Free forever for basic features