SlideShare a Scribd company logo
1 of 10
Download to read offline
DATASTRUCTURES
GRAPHS
Presented by
G.Likhitha
19R01A0411
ECE - A
GRAPHS
• Graph is a non-linear datastructure and is a set of vertices and edges.
set of (V,E) pairs
V-Vertices,E-Edges
• Vertcies can be represented as circles also known as nodes.
• Edge is represented as the line which is connecting two nodes.
Ex:
Here A,B,C are vertices.
(A,B),(B,C),(A,C) are edges.
Graph is a closed figure.
GRAPH TERMINOLOGY
1. Node: The vertices represented as circle.
2. Edge: The connection between two nodes represented by a line.
3. Adjacent node: The node which connects their edges.
4. Degree of a node: The no. of edges corresponding to a particular
node.
Degree(A) =2,Degree(B)=2 ,Degree(C)=2
5. Size of a graph : The total no. of edges in a graph .
The total no. of edges are 3 so the size of the graph is 3.
6. Path : The sequence of vertices from source to destination.
-> A to C
-> A-B-C
-> A-D-C
TYPES OF GRAPHS
1. Directed graph: The direction is specified on the edge.
2. Undirected graph: No direction is specified on the edge.
3. Weighted graph: Need to specify weight for the edge.
4. Unweighted graph: No need to specify weight for the edge.
5. Cyclic garph: Starting and ending point should be same
6. Acyclic graph: The graph doesn’t need to be a cycle.
Undirected Graph Directed Graph Weigted Graph Unweighted Graph Cyclic Graph Acyclic Graph
REPRESENTATION OF GRAPHS
• Graphs can be represented by,
• Adjacency matrix : In this representation, the graph can be represented by
using a matrix of size total number of vertices by total no.of vertices.A graph
with 4 vertices can be represented by 4×4 class.Both rows and columns
represents vertices.The matrix is either filled with 1 or 0. Here 1 represents
edge from row to column vertex and 0 represents there is no edge.
->Representation of undirected and directed graph.
2. Adjacency list: In this representation, every vertex of graph contains
list of its adjacent vertices.
->Directed graph representation using linked list and array.
APPLICATIONS OF GRAPHS
1. Analysis of electrical circuit.
2. It is used in project planning.
3. It is widely used in mathematical applications.
4. It is used in computer network.
5. Finding shortest routes.
Graphs in datastructures

More Related Content

What's hot (20)

Adjacency list
Adjacency listAdjacency list
Adjacency list
 
Trees
TreesTrees
Trees
 
Shortest Path in Graph
Shortest Path in GraphShortest Path in Graph
Shortest Path in Graph
 
Data Structure (Tree)
Data Structure (Tree)Data Structure (Tree)
Data Structure (Tree)
 
Graphs
GraphsGraphs
Graphs
 
Algorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsAlgorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph Algorithms
 
Linked List
Linked ListLinked List
Linked List
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
Heap tree
Heap treeHeap tree
Heap tree
 
introduction to graph theory
introduction to graph theoryintroduction to graph theory
introduction to graph theory
 
Data structure computer graphs
Data structure computer graphsData structure computer graphs
Data structure computer graphs
 
Graph theory
Graph  theoryGraph  theory
Graph theory
 
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
 
B trees dbms
B trees dbmsB trees dbms
B trees dbms
 
Binary tree
Binary treeBinary tree
Binary tree
 
Tree Traversal
Tree TraversalTree Traversal
Tree Traversal
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Topological Sorting
Topological SortingTopological Sorting
Topological Sorting
 
Graph traversal-BFS & DFS
Graph traversal-BFS & DFSGraph traversal-BFS & DFS
Graph traversal-BFS & DFS
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
 

Similar to Graphs in datastructures (20)

Basics of graph
Basics of graphBasics of graph
Basics of graph
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Graphs
GraphsGraphs
Graphs
 
Graphs.pptx
Graphs.pptxGraphs.pptx
Graphs.pptx
 
ppt 1.pptx
ppt 1.pptxppt 1.pptx
ppt 1.pptx
 
Graph theory
Graph theoryGraph theory
Graph theory
 
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
 
Graph therory
Graph theroryGraph therory
Graph therory
 
Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx ppt
 
Graph 1
Graph 1Graph 1
Graph 1
 
09_Graphs_handout.pdf
09_Graphs_handout.pdf09_Graphs_handout.pdf
09_Graphs_handout.pdf
 
Unit V - ppt.pptx
Unit V - ppt.pptxUnit V - ppt.pptx
Unit V - ppt.pptx
 
Electrical Network Topology
Electrical Network TopologyElectrical Network Topology
Electrical Network Topology
 
Graphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ programGraphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ program
 
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjteUnit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
 
Graph data structure and algorithms
Graph data structure and algorithmsGraph data structure and algorithms
Graph data structure and algorithms
 
Graph ASS DBATU.pptx
Graph ASS DBATU.pptxGraph ASS DBATU.pptx
Graph ASS DBATU.pptx
 
Graphs data structures
Graphs data structuresGraphs data structures
Graphs data structures
 
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
 
Algorithms and data Chapter 3 V Graph.pptx
Algorithms and data Chapter 3 V Graph.pptxAlgorithms and data Chapter 3 V Graph.pptx
Algorithms and data Chapter 3 V Graph.pptx
 

Recently uploaded

Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture designssuser87fa0c1
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixingviprabot1
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIkoyaldeepu123
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 

Recently uploaded (20)

Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixing
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AI
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 

Graphs in datastructures

  • 2.
  • 3. GRAPHS • Graph is a non-linear datastructure and is a set of vertices and edges. set of (V,E) pairs V-Vertices,E-Edges • Vertcies can be represented as circles also known as nodes. • Edge is represented as the line which is connecting two nodes. Ex: Here A,B,C are vertices. (A,B),(B,C),(A,C) are edges. Graph is a closed figure.
  • 4. GRAPH TERMINOLOGY 1. Node: The vertices represented as circle. 2. Edge: The connection between two nodes represented by a line. 3. Adjacent node: The node which connects their edges. 4. Degree of a node: The no. of edges corresponding to a particular node. Degree(A) =2,Degree(B)=2 ,Degree(C)=2
  • 5. 5. Size of a graph : The total no. of edges in a graph . The total no. of edges are 3 so the size of the graph is 3. 6. Path : The sequence of vertices from source to destination. -> A to C -> A-B-C -> A-D-C
  • 6. TYPES OF GRAPHS 1. Directed graph: The direction is specified on the edge. 2. Undirected graph: No direction is specified on the edge. 3. Weighted graph: Need to specify weight for the edge. 4. Unweighted graph: No need to specify weight for the edge. 5. Cyclic garph: Starting and ending point should be same 6. Acyclic graph: The graph doesn’t need to be a cycle. Undirected Graph Directed Graph Weigted Graph Unweighted Graph Cyclic Graph Acyclic Graph
  • 7. REPRESENTATION OF GRAPHS • Graphs can be represented by, • Adjacency matrix : In this representation, the graph can be represented by using a matrix of size total number of vertices by total no.of vertices.A graph with 4 vertices can be represented by 4×4 class.Both rows and columns represents vertices.The matrix is either filled with 1 or 0. Here 1 represents edge from row to column vertex and 0 represents there is no edge. ->Representation of undirected and directed graph.
  • 8. 2. Adjacency list: In this representation, every vertex of graph contains list of its adjacent vertices. ->Directed graph representation using linked list and array.
  • 9. APPLICATIONS OF GRAPHS 1. Analysis of electrical circuit. 2. It is used in project planning. 3. It is widely used in mathematical applications. 4. It is used in computer network. 5. Finding shortest routes.