Discrete Structure and
Graph Theory
INTRODUCTION
What is Discrete Structures?
A branch of mathematics dealing with separate, distinct values (not continuous).
Focuses on countable, logical structures used in Computer Science.
Examples: Bits (0/1), Logic gates, Algorithms, Graphs.
Why Learn Discrete Structures?
Foundation for many CS topics:
🔹 Data Structures
🔹 Algorithms
🔹 Operating Systems
🔹 Networking
🔹 Cryptography
Applications in Real Life
1. Search Engines: Graph theory, logic
2. Social Networks: Graphs and relations
3. Databases: Sets and functions
4. Cybersecurity: Logic and number theory
5. AI & Machine Learning: Probability
Basic Set Theory
A set is a collection of distinct objects or elements.
Set theory helps in organizing and grouping data.
Operations include union, intersection, difference, and complement.
Example in Computing: Handling data lists, search results, or database records.
2. Logical Operators
These are the building blocks of decision-making in programs.
Common operators:
● AND (∧)
● OR (∨)
● NOT (¬)
● IMPLIES (→)
3. Truth Tables
● A truth table shows all possible combinations of truth values for logical
expressions.
● It helps in testing the correctness of logic statements.
● Used in digital circuits, programming conditions, and proving logical
equivalences.
4. Cartesian Product
The Cartesian product of two sets A and B is the set of all possible ordered pairs
(a, b).
Example: If A = {1, 2} and B = {x, y}, then A × B = {(1,x), (1,y), (2,x), (2,y)}
Used in database joins and modeling relationships.
5. Types of Functions
● A function maps each element of one set to exactly one element of another
set.
● Types:
○ One-to-One (Injective)
○ Onto (Surjective)
○ Bijective (both)
● Functions are core to algorithms, encryption, and programming logic.
6. Graph Basics
● A graph consists of vertices (nodes) and edges (connections).
● Graphs are used to represent networks, maps, relationships, and more.
● Types include directed, undirected, weighted, unweighted.
● Example: Social media connections, shortest path algorithms in maps.