SlideShare a Scribd company logo
Introduction
Basic Graph Theory
Saksham Agrawal
August 30, 2015
Saksham Agrawal
Basic Graph Theory
Introduction
List Of Contents
1- Introduction To Graph
2- Definitions And Terminology
3- Graph Representation
4- Breadth First Search
5- Depth first search
Saksham Agrawal
Basic Graph Theory
Introduction
Introduction To Graphs
In mathematics and computer science, graph theory is the
study of graphs, which are mathematical structures used to model
pairwise relations between objects. A ”graph” in this context is
made up of ”vertices” or ”nodes” and lines called edges that
connect them.
A graph may be undirected, meaning that there is no
distinction between the two vertices associated with each edge, or
its edges may be directed from one vertex to another. Graphs are
one of the prime objects of study in discrete mathematics.
Saksham Agrawal
Basic Graph Theory
Introduction
Figure: A Typical Graph
Saksham Agrawal
Basic Graph Theory
Introduction
Definitions And Terminology
Graphs are much clear when defined in mathematical terms. A
Graph G (V, E), consists of two sets,
Set of Vertices, V Set of Edges, E As the name suggest, V, is the
set of vertices or, the set of all nodes in a given graph and E, is the
set of all the edges between these nodes, or the associations
between them. So, V denotes the number of nodes in a graph and
E denotes the number of edges
Saksham Agrawal
Basic Graph Theory
Introduction
Figure: Types Of Graph
Saksham Agrawal
Basic Graph Theory
Introduction
Graph Representations ⇒
Adjacency Matrix
Adjacency List
Saksham Agrawal
Basic Graph Theory
Introduction
Adjacency Matrix
Figure: Adjacency Matrix Of Shown Graph
Saksham Agrawal
Basic Graph Theory
Introduction
Adjacency List
Figure: Adjacency List Of Shown Graph
Saksham Agrawal
Basic Graph Theory
Introduction
Breadth first Search
In BFS,we use a queue and we push the current vertex in the
queue and the vertices which are adjacent to the current vertex
using the adjacency list.We also maintain a visited array in which
we record the visited vertices so as to prevent revisiting the same
vertex.After we have pushed the adjacent vertices of a vertex we
pop it out of the queue.
Saksham Agrawal
Basic Graph Theory
Introduction
BFS algorithm
Saksham Agrawal
Basic Graph Theory
Introduction
Application of BFS
BFS is mainly used in a connected graph in which we want to find
the shortest path between 2 vertices.In this we also maintain a
level array.We start from one of the 2 vertices and set its level as 0
and the set level of the adjacent vertices as level of parent+1 and
traverse the graph in this until we reach the other vertex.The level
of the vertex represents the shortest path between the two vertices.
Saksham Agrawal
Basic Graph Theory
Introduction
Depth First Search
Algorithm:- When we see a maze in a newspaper or a magazine
or anywhere else, the way we solve it is we take a path and go
through it. If we find any junction or a crossroad, where we have a
choice of paths to choose, we mark that junction, take up a path
and traverse the whole route in your brain. If we see a dead end,
we realize that this leads we now where so we come back to the
junction we marked before and take up another path of the
junction. See if that is also a dead end, else we continue to explore
the, puzzle as this route contributes in reaching our destination.In
code, we do this by recursion.
Saksham Agrawal
Basic Graph Theory
Introduction
DFS step-by-step process
For a given set of vertices V = V1, V2,V3. . . , start with V1,
and explore all the vertices that can possibly be reached from V1.
Then go to the next vertex V2, if it hasn’t been visited, explore
all the nodes reachable from V2, if not, go for V3.
Similarly, go on picking up all the vertices one-by-one and
explore as much as possible if it wasn’t visited at all.
Saksham Agrawal
Basic Graph Theory
Introduction
Saksham Agrawal
Basic Graph Theory
Introduction
Application of DFS
DFS is also used for finding the shortest path between two
vertices.It is also used to do topological sorting.
Topological Sorting:-
It represents the logical order of doing
something. For instance,we wear socks before shoes and after we
tie laces.In the similar way in topological sorting a vertex appears
only when all its adjacent vertices have already appeared.It is
logical that topological sorting is done in only a directed
graph.Obviously, the vertex with no child is one which appears in
front.This is done using a stack and DFS on a graph.
Saksham Agrawal
Basic Graph Theory

More Related Content

What's hot

Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
Subid Biswas
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithmmeisamstar
 
Ppt of graph theory
Ppt of graph theoryPpt of graph theory
Ppt of graph theory
ArvindBorge
 
Dijkstra's algorithm
Dijkstra's algorithmDijkstra's algorithm
Dijkstra's algorithmgsp1294
 
Graphs - Discrete Math
Graphs - Discrete MathGraphs - Discrete Math
Graphs - Discrete Math
Sikder Tahsin Al-Amin
 
Graph theory
Graph theoryGraph theory
Graph theory
AparnaKumari31
 
Graph theory presentation
Graph theory presentationGraph theory presentation
Graph theory presentation
Aliul Kadir Akib
 
Graph isomorphism
Graph isomorphismGraph isomorphism
Graph isomorphismCore Condor
 
Graph theory
Graph theory Graph theory
Graph theory
iranian translate
 
MATCHING GRAPH THEORY
MATCHING GRAPH THEORYMATCHING GRAPH THEORY
MATCHING GRAPH THEORY
garishma bhatia
 
Graph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphsGraph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphs
Ashikur Rahman
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Mydul Islam Rashed
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithmSrikrishnan Suresh
 
Matrix Representation Of Graph
Matrix Representation Of GraphMatrix Representation Of Graph
Matrix Representation Of GraphAbhishek Pachisia
 
mathematical induction
mathematical inductionmathematical induction
mathematical inductionankush_kumar
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
ArijitDhali
 
Curve sketching
Curve sketchingCurve sketching
Curve sketching
Rnold Wilson
 
Graph theory
Graph theoryGraph theory
Graph theoryKumar
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
Premsankar Chakkingal
 

What's hot (20)

Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithm
 
Ppt of graph theory
Ppt of graph theoryPpt of graph theory
Ppt of graph theory
 
Dijkstra's algorithm
Dijkstra's algorithmDijkstra's algorithm
Dijkstra's algorithm
 
Graphs - Discrete Math
Graphs - Discrete MathGraphs - Discrete Math
Graphs - Discrete Math
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graph theory presentation
Graph theory presentationGraph theory presentation
Graph theory presentation
 
Graph isomorphism
Graph isomorphismGraph isomorphism
Graph isomorphism
 
Graph theory
Graph theory Graph theory
Graph theory
 
MATCHING GRAPH THEORY
MATCHING GRAPH THEORYMATCHING GRAPH THEORY
MATCHING GRAPH THEORY
 
Graph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphsGraph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphs
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
Matrix Representation Of Graph
Matrix Representation Of GraphMatrix Representation Of Graph
Matrix Representation Of Graph
 
Graph theory
Graph theoryGraph theory
Graph theory
 
mathematical induction
mathematical inductionmathematical induction
mathematical induction
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
Curve sketching
Curve sketchingCurve sketching
Curve sketching
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 

Viewers also liked

Survey on Frequent Pattern Mining on Graph Data - Slides
Survey on Frequent Pattern Mining on Graph Data - SlidesSurvey on Frequent Pattern Mining on Graph Data - Slides
Survey on Frequent Pattern Mining on Graph Data - SlidesKasun Gajasinghe
 
Graph
GraphGraph
Graph
ssnetvnr
 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Saurabh Kaushik
 
CS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf bookCS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf book
appasami
 
Interesting applications of graph theory
Interesting applications of graph theoryInteresting applications of graph theory
Interesting applications of graph theoryTech_MX
 
Financial planning in the brain scanner slidecast
Financial planning in the brain scanner slidecastFinancial planning in the brain scanner slidecast
Financial planning in the brain scanner slidecast
Russell James
 
Neuronvisio Intro
Neuronvisio IntroNeuronvisio Intro
Neuronvisio Intro
Michele Mattioni
 
gSpan algorithm
 gSpan algorithm gSpan algorithm
gSpan algorithm
Sadik Mussah
 
Presentation Internship Brain Connectivity Graph 2014 (ENG)
Presentation Internship Brain Connectivity Graph 2014 (ENG)Presentation Internship Brain Connectivity Graph 2014 (ENG)
Presentation Internship Brain Connectivity Graph 2014 (ENG)Romain Chion
 
Introduction to graph theory (All chapter)
Introduction to graph theory (All chapter)Introduction to graph theory (All chapter)
Introduction to graph theory (All chapter)
sobia1122
 
burton_discrete_graph theory
burton_discrete_graph theoryburton_discrete_graph theory
burton_discrete_graph theoryguest63f42b
 
The Graph Structure of the Web - Aggregated by Pay-Level Domain
The Graph Structure of the Web - Aggregated by Pay-Level DomainThe Graph Structure of the Web - Aggregated by Pay-Level Domain
The Graph Structure of the Web - Aggregated by Pay-Level Domain
oli-unima
 
How to read academic research (beginner's guide)
How to read academic research (beginner's guide)How to read academic research (beginner's guide)
How to read academic research (beginner's guide)
Russell James
 
Discreet_Set Theory
Discreet_Set TheoryDiscreet_Set Theory
Discreet_Set Theory
guest68d714
 
Talking Planned Giving: Words that Work
Talking Planned Giving: Words that Work Talking Planned Giving: Words that Work
Talking Planned Giving: Words that Work
Russell James
 
Trends In Graph Data Management And Mining
Trends In Graph Data Management And MiningTrends In Graph Data Management And Mining
Trends In Graph Data Management And Mining
Srinath Srinivasa
 
Class 1 f_mri_intro
Class 1 f_mri_introClass 1 f_mri_intro
Class 1 f_mri_intro景淳 許
 
Graph theory
Graph theoryGraph theory
Graph theory
Timothy Pastoral
 
Graph Theory Application - Not Only for Engineering Problems
Graph Theory Application - Not Only for Engineering ProblemsGraph Theory Application - Not Only for Engineering Problems
Graph Theory Application - Not Only for Engineering Problems
Society of Women Engineers
 

Viewers also liked (20)

Survey on Frequent Pattern Mining on Graph Data - Slides
Survey on Frequent Pattern Mining on Graph Data - SlidesSurvey on Frequent Pattern Mining on Graph Data - Slides
Survey on Frequent Pattern Mining on Graph Data - Slides
 
Graph
GraphGraph
Graph
 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
 
CS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf bookCS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf book
 
Interesting applications of graph theory
Interesting applications of graph theoryInteresting applications of graph theory
Interesting applications of graph theory
 
Financial planning in the brain scanner slidecast
Financial planning in the brain scanner slidecastFinancial planning in the brain scanner slidecast
Financial planning in the brain scanner slidecast
 
Neuronvisio Intro
Neuronvisio IntroNeuronvisio Intro
Neuronvisio Intro
 
gSpan algorithm
 gSpan algorithm gSpan algorithm
gSpan algorithm
 
Presentation Internship Brain Connectivity Graph 2014 (ENG)
Presentation Internship Brain Connectivity Graph 2014 (ENG)Presentation Internship Brain Connectivity Graph 2014 (ENG)
Presentation Internship Brain Connectivity Graph 2014 (ENG)
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Introduction to graph theory (All chapter)
Introduction to graph theory (All chapter)Introduction to graph theory (All chapter)
Introduction to graph theory (All chapter)
 
burton_discrete_graph theory
burton_discrete_graph theoryburton_discrete_graph theory
burton_discrete_graph theory
 
The Graph Structure of the Web - Aggregated by Pay-Level Domain
The Graph Structure of the Web - Aggregated by Pay-Level DomainThe Graph Structure of the Web - Aggregated by Pay-Level Domain
The Graph Structure of the Web - Aggregated by Pay-Level Domain
 
How to read academic research (beginner's guide)
How to read academic research (beginner's guide)How to read academic research (beginner's guide)
How to read academic research (beginner's guide)
 
Discreet_Set Theory
Discreet_Set TheoryDiscreet_Set Theory
Discreet_Set Theory
 
Talking Planned Giving: Words that Work
Talking Planned Giving: Words that Work Talking Planned Giving: Words that Work
Talking Planned Giving: Words that Work
 
Trends In Graph Data Management And Mining
Trends In Graph Data Management And MiningTrends In Graph Data Management And Mining
Trends In Graph Data Management And Mining
 
Class 1 f_mri_intro
Class 1 f_mri_introClass 1 f_mri_intro
Class 1 f_mri_intro
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graph Theory Application - Not Only for Engineering Problems
Graph Theory Application - Not Only for Engineering ProblemsGraph Theory Application - Not Only for Engineering Problems
Graph Theory Application - Not Only for Engineering Problems
 

Similar to Graph Theory

Unit V - ppt.pptx
Unit V - ppt.pptxUnit V - ppt.pptx
Graphs
GraphsGraphs
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
SwarndeviKm
 
Topological Sort and BFS
Topological Sort and BFSTopological Sort and BFS
Topological Sort and BFS
ArchanaMani2
 
Data structure note
Data structure noteData structure note
Data structure note
Muhammad Nawaz
 
Graphs data structures
Graphs data structuresGraphs data structures
Graphs data structures
Jasleen Kaur (Chandigarh University)
 
graph representation.pdf
graph representation.pdfgraph representation.pdf
graph representation.pdf
amitbhachne
 
Daa chpater 12
Daa chpater 12Daa chpater 12
Daa chpater 12
B.Kirron Reddi
 
data structures and algorithms Unit 2
data structures and algorithms Unit 2data structures and algorithms Unit 2
data structures and algorithms Unit 2
infanciaj
 
Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx ppt
DhruvilSTATUS
 
Depth First Search (DFS) pada Graph
Depth First Search (DFS) pada GraphDepth First Search (DFS) pada Graph
Depth First Search (DFS) pada Graph
Achmad Solichin
 
DATA STRUCTURES.pptx
DATA STRUCTURES.pptxDATA STRUCTURES.pptx
DATA STRUCTURES.pptx
KENNEDY GITHAIGA
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data Structure
Afaq Mansoor Khan
 
Breadth First Search (BFS) pada Graph
Breadth First Search (BFS) pada GraphBreadth First Search (BFS) pada Graph
Breadth First Search (BFS) pada Graph
Achmad Solichin
 
Vanmathy no sql
Vanmathy no sql Vanmathy no sql
Vanmathy no sql
PriyadharshiniVS
 
VANU no sql ppt.pptx
VANU no sql ppt.pptxVANU no sql ppt.pptx
VANU no sql ppt.pptx
MJeyavarthini
 
Topoloical sort
Topoloical sortTopoloical sort
Topoloical sort
sahilnarvekar
 
Graph Representation
Graph RepresentationGraph Representation
Graph Representation
Ramkrishna bhagat
 
Lecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptxLecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptx
king779879
 

Similar to Graph Theory (20)

Unit V - ppt.pptx
Unit V - ppt.pptxUnit V - ppt.pptx
Unit V - ppt.pptx
 
Graphs
GraphsGraphs
Graphs
 
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
 
Topological Sort and BFS
Topological Sort and BFSTopological Sort and BFS
Topological Sort and BFS
 
Data structure note
Data structure noteData structure note
Data structure note
 
Graphs data structures
Graphs data structuresGraphs data structures
Graphs data structures
 
graph representation.pdf
graph representation.pdfgraph representation.pdf
graph representation.pdf
 
Daa chpater 12
Daa chpater 12Daa chpater 12
Daa chpater 12
 
data structures and algorithms Unit 2
data structures and algorithms Unit 2data structures and algorithms Unit 2
data structures and algorithms Unit 2
 
logic.pptx
logic.pptxlogic.pptx
logic.pptx
 
Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx ppt
 
Depth First Search (DFS) pada Graph
Depth First Search (DFS) pada GraphDepth First Search (DFS) pada Graph
Depth First Search (DFS) pada Graph
 
DATA STRUCTURES.pptx
DATA STRUCTURES.pptxDATA STRUCTURES.pptx
DATA STRUCTURES.pptx
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data Structure
 
Breadth First Search (BFS) pada Graph
Breadth First Search (BFS) pada GraphBreadth First Search (BFS) pada Graph
Breadth First Search (BFS) pada Graph
 
Vanmathy no sql
Vanmathy no sql Vanmathy no sql
Vanmathy no sql
 
VANU no sql ppt.pptx
VANU no sql ppt.pptxVANU no sql ppt.pptx
VANU no sql ppt.pptx
 
Topoloical sort
Topoloical sortTopoloical sort
Topoloical sort
 
Graph Representation
Graph RepresentationGraph Representation
Graph Representation
 
Lecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptxLecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptx
 

More from Shivam Singh

Stacks
StacksStacks
Stacks
Shivam Singh
 
Trees
TreesTrees
What If Microsoft sold diapers!? MS Diapers!
What If Microsoft sold diapers!? MS Diapers!What If Microsoft sold diapers!? MS Diapers!
What If Microsoft sold diapers!? MS Diapers!
Shivam Singh
 
Search Algprithms
Search AlgprithmsSearch Algprithms
Search Algprithms
Shivam Singh
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
Shivam Singh
 
Linked List
Linked ListLinked List
Linked List
Shivam Singh
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Shivam Singh
 

More from Shivam Singh (7)

Stacks
StacksStacks
Stacks
 
Trees
TreesTrees
Trees
 
What If Microsoft sold diapers!? MS Diapers!
What If Microsoft sold diapers!? MS Diapers!What If Microsoft sold diapers!? MS Diapers!
What If Microsoft sold diapers!? MS Diapers!
 
Search Algprithms
Search AlgprithmsSearch Algprithms
Search Algprithms
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Linked List
Linked ListLinked List
Linked List
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 

Recently uploaded

Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 

Recently uploaded (20)

Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 

Graph Theory

  • 1. Introduction Basic Graph Theory Saksham Agrawal August 30, 2015 Saksham Agrawal Basic Graph Theory
  • 2. Introduction List Of Contents 1- Introduction To Graph 2- Definitions And Terminology 3- Graph Representation 4- Breadth First Search 5- Depth first search Saksham Agrawal Basic Graph Theory
  • 3. Introduction Introduction To Graphs In mathematics and computer science, graph theory is the study of graphs, which are mathematical structures used to model pairwise relations between objects. A ”graph” in this context is made up of ”vertices” or ”nodes” and lines called edges that connect them. A graph may be undirected, meaning that there is no distinction between the two vertices associated with each edge, or its edges may be directed from one vertex to another. Graphs are one of the prime objects of study in discrete mathematics. Saksham Agrawal Basic Graph Theory
  • 4. Introduction Figure: A Typical Graph Saksham Agrawal Basic Graph Theory
  • 5. Introduction Definitions And Terminology Graphs are much clear when defined in mathematical terms. A Graph G (V, E), consists of two sets, Set of Vertices, V Set of Edges, E As the name suggest, V, is the set of vertices or, the set of all nodes in a given graph and E, is the set of all the edges between these nodes, or the associations between them. So, V denotes the number of nodes in a graph and E denotes the number of edges Saksham Agrawal Basic Graph Theory
  • 6. Introduction Figure: Types Of Graph Saksham Agrawal Basic Graph Theory
  • 7. Introduction Graph Representations ⇒ Adjacency Matrix Adjacency List Saksham Agrawal Basic Graph Theory
  • 8. Introduction Adjacency Matrix Figure: Adjacency Matrix Of Shown Graph Saksham Agrawal Basic Graph Theory
  • 9. Introduction Adjacency List Figure: Adjacency List Of Shown Graph Saksham Agrawal Basic Graph Theory
  • 10. Introduction Breadth first Search In BFS,we use a queue and we push the current vertex in the queue and the vertices which are adjacent to the current vertex using the adjacency list.We also maintain a visited array in which we record the visited vertices so as to prevent revisiting the same vertex.After we have pushed the adjacent vertices of a vertex we pop it out of the queue. Saksham Agrawal Basic Graph Theory
  • 12. Introduction Application of BFS BFS is mainly used in a connected graph in which we want to find the shortest path between 2 vertices.In this we also maintain a level array.We start from one of the 2 vertices and set its level as 0 and the set level of the adjacent vertices as level of parent+1 and traverse the graph in this until we reach the other vertex.The level of the vertex represents the shortest path between the two vertices. Saksham Agrawal Basic Graph Theory
  • 13. Introduction Depth First Search Algorithm:- When we see a maze in a newspaper or a magazine or anywhere else, the way we solve it is we take a path and go through it. If we find any junction or a crossroad, where we have a choice of paths to choose, we mark that junction, take up a path and traverse the whole route in your brain. If we see a dead end, we realize that this leads we now where so we come back to the junction we marked before and take up another path of the junction. See if that is also a dead end, else we continue to explore the, puzzle as this route contributes in reaching our destination.In code, we do this by recursion. Saksham Agrawal Basic Graph Theory
  • 14. Introduction DFS step-by-step process For a given set of vertices V = V1, V2,V3. . . , start with V1, and explore all the vertices that can possibly be reached from V1. Then go to the next vertex V2, if it hasn’t been visited, explore all the nodes reachable from V2, if not, go for V3. Similarly, go on picking up all the vertices one-by-one and explore as much as possible if it wasn’t visited at all. Saksham Agrawal Basic Graph Theory
  • 16. Introduction Application of DFS DFS is also used for finding the shortest path between two vertices.It is also used to do topological sorting. Topological Sorting:- It represents the logical order of doing something. For instance,we wear socks before shoes and after we tie laces.In the similar way in topological sorting a vertex appears only when all its adjacent vertices have already appeared.It is logical that topological sorting is done in only a directed graph.Obviously, the vertex with no child is one which appears in front.This is done using a stack and DFS on a graph. Saksham Agrawal Basic Graph Theory