SlideShare une entreprise Scribd logo
1  sur  18
GRAPH
Graph
A graph G = (V,E) is composed of:
             V: set of vertices
             E: set of edges connecting the vertices in V
An edge e = (u,v) is a pair of vertices
Example:
            a                        b
                                             V= {a,b,c,d,e}

                         c                   E= {(a,b),(a,c),
                                             (a,d),
                                             (b,e),(c,d),(c,e),
            d                        e       (d,e)}
Types
• Graphs are generally classified as,

     Directed graph
     Undirected graph
Directed graph
• A graphs G is called directed graph if each edge
  has a direction.
Un Directed graph
• A graphs G is called directed graph if each edge
  has no direction.
Graph Terminology:
 Node

 Each element of a graph is called node of a graph

 Edge

 Line joining two nodes is called an edge. It is denoted by
 e=[u,v] where u and v are adjacent vertices.
                             V1


                 e1
                      edge


                                       node
          V2           e2         V2
Adjacent and Incident
 If (v0, v1) is an edge in an undirected graph,
   v0 and v1 are adjacent
   The edge (v0, v1) is incident on vertices v0 and v1

 If <v0, v1> is an edge in a directed graph
   v0 is adjacent to v1, and v1 is adjacent from v0
   The edge <v0, v1> is incident on v0 and v1
Degree of a Vertex
• The degree of a vertex is the number of edges incident to that vertex

• For directed graph,
    •   the in-degree of a vertex v is the number of edges
        that have v as the head
    •   the out-degree of a vertex v is the number of edges
        that have v as the tail
    •   if di is the degree of a vertex i in a graph G with n vertices and e
        edges, the number of edges is
Examples                                     0
          3                                  2
          0                          1               2
                                     3               3
  3 1             2 3            3       4       5       6
          31
          G                      1      1 G2 1           1
              3
                        0    in:1, out: 1
 directed graph
 in-degree
 out-degree             1    in: 1, out: 2


                        2    in: 1, out: 0
                        G3
Path
path:         sequence of
                                   3                  2
vertices v1,v2,. . .vk such
that consecutive vertices vi               3
and vi+1 are adjacent.
                                   3                  3

                               a           b a            b


                                       c          c

                               d           e d            e
                                   abedc         bedc


                                                          10
simple path: no repeated vertices
                                  a                   b

                                                          bec
                                            c


                                  d                   e
cycle: simple path, except that the last vertex is the same as the
first vertex
•connected graph: any two vertices are connected by some path




                connected             not connected
 subgraph: subset of vertices and edges forming a graph
 connected component: maximal connected subgraph. E.g., the graph below has
 3 connected components.
Completed graph
• A graph G is called complete, if every nodes are adjacent
  with other nodes.

                v1                   v3



                v2                   v4
Graph Representations

• Set representation

• Sequential representation

   • Adjacency Matrix

   • Path Matrix

• Linked list representation
Adjacency Matrix
• Let G=(V,E) be a graph with n vertices.

• The adjacency matrix of G is a two-dimensional
   n by n array, say adj_mat
• If the edge (vi, vj) is in E(G), adj_mat[i][j]=1

• If there is no such edge in E(G), adj_mat[i][j]=0

• The adjacency matrix for an undirected graph is symmetric; the
   adjacency matrix for a digraph
   need not be symmetric
Examples for Adjacency Matrix
      0                                   0                4
                       0
                                      2       1        5
1           2
                                          3                6
      3                1
                                                       7
                       2

                           G2
       G1


                   symmetric

    undirected: n2/2
    directed: n2
                                                  G4
Merits of Adjacency Matrix
• From the adjacency matrix, to determine the connection of
  vertices is easy
• The degree of a vertex is

• For a digraph (= directed graph), the row sum is the
  out_degree, while the column sum is the in_degree
The End..




            THANK YOU

Contenu connexe

Tendances

Graph theory
Graph theoryGraph theory
Graph theoryGaditek
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structurehafsa komal
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - GraphMadhu Bala
 
Fifth normal form
Fifth normal formFifth normal form
Fifth normal formAthi Sethu
 
2.5 bfs & dfs 02
2.5 bfs & dfs 022.5 bfs & dfs 02
2.5 bfs & dfs 02Krish_ver2
 
Graphs in data structure
Graphs in data structureGraphs in data structure
Graphs in data structurehamza javed
 
Application Of Graph Data Structure
Application Of Graph Data StructureApplication Of Graph Data Structure
Application Of Graph Data StructureGaurang Dobariya
 
Adjacency list
Adjacency listAdjacency list
Adjacency listStefi Yu
 
Depth firstsearchalgorithm
Depth firstsearchalgorithmDepth firstsearchalgorithm
Depth firstsearchalgorithmhansa khan
 
Binary search tree deletion
Binary search tree deletionBinary search tree deletion
Binary search tree deletionKousalya M
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's AlgorithmArijitDhali
 
Data structure computer graphs
Data structure computer graphsData structure computer graphs
Data structure computer graphsKumar
 
17. Trees and Graphs
17. Trees and Graphs17. Trees and Graphs
17. Trees and GraphsIntro C# Book
 
Graphs in data structures
Graphs in data structuresGraphs in data structures
Graphs in data structuresSavit Chandra
 
Functional dependencies in Database Management System
Functional dependencies in Database Management SystemFunctional dependencies in Database Management System
Functional dependencies in Database Management SystemKevin Jadiya
 

Tendances (20)

Graph theory
Graph theoryGraph theory
Graph theory
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structure
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
Fifth normal form
Fifth normal formFifth normal form
Fifth normal form
 
2.5 bfs & dfs 02
2.5 bfs & dfs 022.5 bfs & dfs 02
2.5 bfs & dfs 02
 
Graphs in data structure
Graphs in data structureGraphs in data structure
Graphs in data structure
 
Application Of Graph Data Structure
Application Of Graph Data StructureApplication Of Graph Data Structure
Application Of Graph Data Structure
 
Adjacency list
Adjacency listAdjacency list
Adjacency list
 
Depth firstsearchalgorithm
Depth firstsearchalgorithmDepth firstsearchalgorithm
Depth firstsearchalgorithm
 
Binary search tree deletion
Binary search tree deletionBinary search tree deletion
Binary search tree deletion
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
Data structure computer graphs
Data structure computer graphsData structure computer graphs
Data structure computer graphs
 
17. Trees and Graphs
17. Trees and Graphs17. Trees and Graphs
17. Trees and Graphs
 
View & index in SQL
View & index in SQLView & index in SQL
View & index in SQL
 
Graphs in data structures
Graphs in data structuresGraphs in data structures
Graphs in data structures
 
Graphs
GraphsGraphs
Graphs
 
Kruskal’s algorithm
Kruskal’s algorithmKruskal’s algorithm
Kruskal’s algorithm
 
Functional dependencies in Database Management System
Functional dependencies in Database Management SystemFunctional dependencies in Database Management System
Functional dependencies in Database Management System
 
SQL
SQLSQL
SQL
 

Similaire à GRAPH REPRESENTATIONS AND TERMINOLOGY

Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data StructureAnuj Modi
 
Graph data structure
Graph data structureGraph data structure
Graph data structureTech_MX
 
Lecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptxLecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptxChandanGiri21
 
Ppt of graph theory
Ppt of graph theoryPpt of graph theory
Ppt of graph theoryArvindBorge
 
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 Graphsssuser034ce1
 
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 Graphsssuser034ce1
 
Matrix representation of graph
Matrix representation of graphMatrix representation of graph
Matrix representation of graphRounak Biswas
 
Graphs (Models & Terminology)
Graphs (Models & Terminology)Graphs (Models & Terminology)
Graphs (Models & Terminology)zunaira saleem
 
Graph representation
Graph representationGraph representation
Graph representationDEEPIKA T
 
Discrete maths assignment
Discrete maths assignmentDiscrete maths assignment
Discrete maths assignmentKeshav Somani
 
graph.pptx
graph.pptxgraph.pptx
graph.pptxhijigaf
 

Similaire à GRAPH REPRESENTATIONS AND TERMINOLOGY (20)

Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
 
Unit 2: All
Unit 2: AllUnit 2: All
Unit 2: All
 
Graph data structure
Graph data structureGraph data structure
Graph data structure
 
graph.pptx
graph.pptxgraph.pptx
graph.pptx
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Graphs.pdf
Graphs.pdfGraphs.pdf
Graphs.pdf
 
Lecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptxLecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptx
 
Graph
GraphGraph
Graph
 
Graphs
GraphsGraphs
Graphs
 
Ppt of graph theory
Ppt of graph theoryPpt of graph theory
Ppt of graph theory
 
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
 
Matrix representation of graph
Matrix representation of graphMatrix representation of graph
Matrix representation of graph
 
Graphs (Models & Terminology)
Graphs (Models & Terminology)Graphs (Models & Terminology)
Graphs (Models & Terminology)
 
09_DS_MCA_Graphs.pdf
09_DS_MCA_Graphs.pdf09_DS_MCA_Graphs.pdf
09_DS_MCA_Graphs.pdf
 
Graph representation
Graph representationGraph representation
Graph representation
 
Graph-theory.ppt
Graph-theory.pptGraph-theory.ppt
Graph-theory.ppt
 
Graph.ppt
Graph.pptGraph.ppt
Graph.ppt
 
Discrete maths assignment
Discrete maths assignmentDiscrete maths assignment
Discrete maths assignment
 
graph.pptx
graph.pptxgraph.pptx
graph.pptx
 

Dernier

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 

Dernier (20)

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 

GRAPH REPRESENTATIONS AND TERMINOLOGY

  • 2. Graph A graph G = (V,E) is composed of: V: set of vertices E: set of edges connecting the vertices in V An edge e = (u,v) is a pair of vertices Example: a b V= {a,b,c,d,e} c E= {(a,b),(a,c), (a,d), (b,e),(c,d),(c,e), d e (d,e)}
  • 3. Types • Graphs are generally classified as, Directed graph Undirected graph
  • 4. Directed graph • A graphs G is called directed graph if each edge has a direction.
  • 5. Un Directed graph • A graphs G is called directed graph if each edge has no direction.
  • 6. Graph Terminology: Node Each element of a graph is called node of a graph Edge Line joining two nodes is called an edge. It is denoted by e=[u,v] where u and v are adjacent vertices. V1 e1 edge node V2 e2 V2
  • 7. Adjacent and Incident If (v0, v1) is an edge in an undirected graph, v0 and v1 are adjacent The edge (v0, v1) is incident on vertices v0 and v1 If <v0, v1> is an edge in a directed graph v0 is adjacent to v1, and v1 is adjacent from v0 The edge <v0, v1> is incident on v0 and v1
  • 8. Degree of a Vertex • The degree of a vertex is the number of edges incident to that vertex • For directed graph, • the in-degree of a vertex v is the number of edges that have v as the head • the out-degree of a vertex v is the number of edges that have v as the tail • if di is the degree of a vertex i in a graph G with n vertices and e edges, the number of edges is
  • 9. Examples 0 3 2 0 1 2 3 3 3 1 2 3 3 4 5 6 31 G 1 1 G2 1 1 3 0 in:1, out: 1 directed graph in-degree out-degree 1 in: 1, out: 2 2 in: 1, out: 0 G3
  • 10. Path path: sequence of 3 2 vertices v1,v2,. . .vk such that consecutive vertices vi 3 and vi+1 are adjacent. 3 3 a b a b c c d e d e abedc bedc 10
  • 11. simple path: no repeated vertices a b bec c d e cycle: simple path, except that the last vertex is the same as the first vertex
  • 12. •connected graph: any two vertices are connected by some path connected not connected subgraph: subset of vertices and edges forming a graph connected component: maximal connected subgraph. E.g., the graph below has 3 connected components.
  • 13. Completed graph • A graph G is called complete, if every nodes are adjacent with other nodes. v1 v3 v2 v4
  • 14. Graph Representations • Set representation • Sequential representation • Adjacency Matrix • Path Matrix • Linked list representation
  • 15. Adjacency Matrix • Let G=(V,E) be a graph with n vertices. • The adjacency matrix of G is a two-dimensional n by n array, say adj_mat • If the edge (vi, vj) is in E(G), adj_mat[i][j]=1 • If there is no such edge in E(G), adj_mat[i][j]=0 • The adjacency matrix for an undirected graph is symmetric; the adjacency matrix for a digraph need not be symmetric
  • 16. Examples for Adjacency Matrix 0 0 4 0 2 1 5 1 2 3 6 3 1 7 2 G2 G1 symmetric undirected: n2/2 directed: n2 G4
  • 17. Merits of Adjacency Matrix • From the adjacency matrix, to determine the connection of vertices is easy • The degree of a vertex is • For a digraph (= directed graph), the row sum is the out_degree, while the column sum is the in_degree
  • 18. The End.. THANK YOU