SlideShare une entreprise Scribd logo
1  sur  12
Graph Theory
Objectives
• Understand the terms:
  – Graph
      • Vertex
      • Arc
  –   Simple Graph
  –   Directed Graph
  –   Adjacency Matrix
  –   Adjacency List
Definitions
• Graph is a finite number of points
  connected by lines. Points are
  normally called vertices or nodes

• Lines are called edges or arcs
   Edge/Arc
                                Vertex
                                Node
Network or weighted graph
• Each edge/arc has an associated
  number
           5
                                Time
                              Distance
                       4
                               Money

    3

                  3
“Connected”
• Vertices are connected if there is a edge
  joining them
• A graph is connected if all pairs of vertices
  are connected
• A Simple Graph is one in which there are no
  loops and at most one edge connects any
  pair of vertices
• A degree (or order) of a vertex is the number
  of edges connected to the vertex
Worked examples
• Simple Graph G has six vertices and
  their degrees are
  2d,2d,2d+1,2d+1,2d+1,3d-1 – where d
  is an integer
• Show that d is even
• Use the fact that the graph is simple to
  show that d < 3 and find a value for d
• Draw a possible graph G
Directed graphs
• Graph that has directed edges, eg:
  arrows on the edges

         8          12


    10
                  15
Complete Graph
• Every vertex is connected by an edge
  to each of the other vertices.

                              5 vertices
                                  4+
                                  3+
                                  2+
                               1 edges
Question
• Graph G has four vertices and edges
  of length 7,8, 8 and 9
• Explain why G is not a complete graph
• Stat the number of edges that must be
  added to G to make it complete

• Draw a directed graph for a round-
  robin tournament involving three
  teams - A, B and C
Adjacency Matrix

             x   1   2   3   4   5
1   3        1   -   1   1   1   0
         5   2   1   -   0   1   0
             3   1   0   -   1   2
2   4
             4   1   1   1   -   1
             5   0   0   2   1   -
Adjacency List
            Vertex   Adjacent
                     Vertices
1   3
            1        2,3,4
        5
            2        1,4
2   4
            3        1,4,5

            4        1,2,3,5

            5        3,4
Objectives
• Understand the terms:
  – Graph
      • Vertex
      • Arc
  –   Simple Graph
  –   Directed Graph
  –   Adjacency Matrix
  –   Adjacency List

Contenu connexe

Tendances (20)

Graph
GraphGraph
Graph
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
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
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data Structure
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structure
 
Graph representation
Graph representationGraph representation
Graph representation
 
Graphs in c language
Graphs in c languageGraphs in c language
Graphs in c language
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
graph theory
graph theory graph theory
graph theory
 
Graph in Data Structure
Graph in Data StructureGraph in Data Structure
Graph in Data Structure
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data Structure
 
Graphs data structures
Graphs data structuresGraphs data structures
Graphs data structures
 
Graph
GraphGraph
Graph
 
Graphs
GraphsGraphs
Graphs
 
Adjacency list
Adjacency listAdjacency list
Adjacency list
 
Lecture8 data structure(graph)
Lecture8 data structure(graph)Lecture8 data structure(graph)
Lecture8 data structure(graph)
 
Graph (Data structure)
Graph (Data structure) Graph (Data structure)
Graph (Data structure)
 
Planar graph
Planar graphPlanar graph
Planar graph
 
d
dd
d
 
Graph data structure
Graph data structureGraph data structure
Graph data structure
 

En vedette

Discreet_Set Theory
Discreet_Set TheoryDiscreet_Set Theory
Discreet_Set Theoryguest68d714
 
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 ProblemsSociety of Women Engineers
 
Graph Theory #searchlove The theory that underpins how all search engines wor...
Graph Theory #searchlove The theory that underpins how all search engines wor...Graph Theory #searchlove The theory that underpins how all search engines wor...
Graph Theory #searchlove The theory that underpins how all search engines wor...Kelvin Newman
 
Graph theory 1
Graph theory 1Graph theory 1
Graph theory 1Tech_MX
 
Graph theory in Practise
Graph theory in PractiseGraph theory in Practise
Graph theory in PractiseDavid Simons
 
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 ColouringSaurabh 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 bookappasami
 
Set Theory
Set TheorySet Theory
Set Theoryitutor
 
Interesting applications of graph theory
Interesting applications of graph theoryInteresting applications of graph theory
Interesting applications of graph theoryTech_MX
 

En vedette (16)

Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Discreet_Set Theory
Discreet_Set TheoryDiscreet_Set Theory
Discreet_Set Theory
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graph
GraphGraph
Graph
 
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
 
Graph Theory #searchlove The theory that underpins how all search engines wor...
Graph Theory #searchlove The theory that underpins how all search engines wor...Graph Theory #searchlove The theory that underpins how all search engines wor...
Graph Theory #searchlove The theory that underpins how all search engines wor...
 
Set Theory In C++
Set Theory In C++Set Theory In C++
Set Theory In C++
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graph theory 1
Graph theory 1Graph theory 1
Graph theory 1
 
Graph theory in Practise
Graph theory in PractiseGraph theory in Practise
Graph theory in Practise
 
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
 
Set Theory
Set TheorySet Theory
Set Theory
 
Interesting applications of graph theory
Interesting applications of graph theoryInteresting applications of graph theory
Interesting applications of graph theory
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 

Similaire à Graph theory (20)

CS-102 Data Structure lectures on Graphs
CS-102 Data Structure lectures on GraphsCS-102 Data Structure lectures on Graphs
CS-102 Data Structure lectures on Graphs
 
CS-102 Data Structure lectures on Graphs
CS-102 Data Structure lectures on GraphsCS-102 Data Structure lectures on Graphs
CS-102 Data Structure lectures on Graphs
 
Unit 2: All
Unit 2: AllUnit 2: All
Unit 2: All
 
ppt 1.pptx
ppt 1.pptxppt 1.pptx
ppt 1.pptx
 
Graphs in datastructures
Graphs in datastructuresGraphs in datastructures
Graphs in datastructures
 
Unit ix graph
Unit   ix    graph Unit   ix    graph
Unit ix graph
 
Unit 9 graph
Unit   9 graphUnit   9 graph
Unit 9 graph
 
Ds lec 5_chap4
Ds lec 5_chap4Ds lec 5_chap4
Ds lec 5_chap4
 
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjteUnit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
Unit II_Graph.pptxkgjrekjgiojtoiejhgnltegjte
 
LEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdfLEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdf
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
 
Lec28
Lec28Lec28
Lec28
 
Lecture8 data structure(graph)
Lecture8 data structure(graph)Lecture8 data structure(graph)
Lecture8 data structure(graph)
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graph Theory: Planarity & Dual Graph
Graph Theory: Planarity & Dual GraphGraph Theory: Planarity & Dual Graph
Graph Theory: Planarity & Dual Graph
 
Basics of graph
Basics of graphBasics of graph
Basics of graph
 
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
 
Graph 1
Graph 1Graph 1
Graph 1
 
Graphs
GraphsGraphs
Graphs
 

Plus de grahamwell

Excel =if function
Excel =if functionExcel =if function
Excel =if functiongrahamwell
 
Excel Min max-average
Excel Min max-average Excel Min max-average
Excel Min max-average grahamwell
 
What is binary and why do we use it?
What is binary and why do we use it?What is binary and why do we use it?
What is binary and why do we use it?grahamwell
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch developgrahamwell
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch developgrahamwell
 
The software story
The software storyThe software story
The software storygrahamwell
 
Turtle graphics
Turtle graphicsTurtle graphics
Turtle graphicsgrahamwell
 
Database field types
Database field typesDatabase field types
Database field typesgrahamwell
 
Pascal names and types
Pascal names and typesPascal names and types
Pascal names and typesgrahamwell
 
Python part two names and types
Python part two names and typesPython part two names and types
Python part two names and typesgrahamwell
 
Abstraction - Year 9
Abstraction - Year 9Abstraction - Year 9
Abstraction - Year 9grahamwell
 
Thinking about your project
Thinking about your projectThinking about your project
Thinking about your projectgrahamwell
 
The rail fence
The rail fenceThe rail fence
The rail fencegrahamwell
 
Rsa encryption
Rsa encryptionRsa encryption
Rsa encryptiongrahamwell
 
Server side scripts
Server side scriptsServer side scripts
Server side scriptsgrahamwell
 
Revision topic 1 sensors and control
Revision topic 1 sensors and controlRevision topic 1 sensors and control
Revision topic 1 sensors and controlgrahamwell
 

Plus de grahamwell (20)

Pseudocode
PseudocodePseudocode
Pseudocode
 
Excel =if function
Excel =if functionExcel =if function
Excel =if function
 
Excel Min max-average
Excel Min max-average Excel Min max-average
Excel Min max-average
 
What is binary and why do we use it?
What is binary and why do we use it?What is binary and why do we use it?
What is binary and why do we use it?
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch develop
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch develop
 
The software story
The software storyThe software story
The software story
 
Turtle graphics
Turtle graphicsTurtle graphics
Turtle graphics
 
Database field types
Database field typesDatabase field types
Database field types
 
Databases 101
Databases 101Databases 101
Databases 101
 
Kodu controls
Kodu controlsKodu controls
Kodu controls
 
Pascal names and types
Pascal names and typesPascal names and types
Pascal names and types
 
Python part two names and types
Python part two names and typesPython part two names and types
Python part two names and types
 
Abstraction - Year 9
Abstraction - Year 9Abstraction - Year 9
Abstraction - Year 9
 
Thinking about your project
Thinking about your projectThinking about your project
Thinking about your project
 
The rail fence
The rail fenceThe rail fence
The rail fence
 
Lesson 1
Lesson 1Lesson 1
Lesson 1
 
Rsa encryption
Rsa encryptionRsa encryption
Rsa encryption
 
Server side scripts
Server side scriptsServer side scripts
Server side scripts
 
Revision topic 1 sensors and control
Revision topic 1 sensors and controlRevision topic 1 sensors and control
Revision topic 1 sensors and control
 

Graph theory

  • 2. Objectives • Understand the terms: – Graph • Vertex • Arc – Simple Graph – Directed Graph – Adjacency Matrix – Adjacency List
  • 3. Definitions • Graph is a finite number of points connected by lines. Points are normally called vertices or nodes • Lines are called edges or arcs Edge/Arc Vertex Node
  • 4. Network or weighted graph • Each edge/arc has an associated number 5 Time Distance 4 Money 3 3
  • 5. “Connected” • Vertices are connected if there is a edge joining them • A graph is connected if all pairs of vertices are connected • A Simple Graph is one in which there are no loops and at most one edge connects any pair of vertices • A degree (or order) of a vertex is the number of edges connected to the vertex
  • 6. Worked examples • Simple Graph G has six vertices and their degrees are 2d,2d,2d+1,2d+1,2d+1,3d-1 – where d is an integer • Show that d is even • Use the fact that the graph is simple to show that d < 3 and find a value for d • Draw a possible graph G
  • 7. Directed graphs • Graph that has directed edges, eg: arrows on the edges 8 12 10 15
  • 8. Complete Graph • Every vertex is connected by an edge to each of the other vertices. 5 vertices 4+ 3+ 2+ 1 edges
  • 9. Question • Graph G has four vertices and edges of length 7,8, 8 and 9 • Explain why G is not a complete graph • Stat the number of edges that must be added to G to make it complete • Draw a directed graph for a round- robin tournament involving three teams - A, B and C
  • 10. Adjacency Matrix x 1 2 3 4 5 1 3 1 - 1 1 1 0 5 2 1 - 0 1 0 3 1 0 - 1 2 2 4 4 1 1 1 - 1 5 0 0 2 1 -
  • 11. Adjacency List Vertex Adjacent Vertices 1 3 1 2,3,4 5 2 1,4 2 4 3 1,4,5 4 1,2,3,5 5 3,4
  • 12. Objectives • Understand the terms: – Graph • Vertex • Arc – Simple Graph – Directed Graph – Adjacency Matrix – Adjacency List