SlideShare a Scribd company logo
1 of 17
Graph – Basic concepts
Basic Concepts
A graph is an ordered pair (V, E).
V is the set of vertices. (You can think of them as integers 1,
2, …, n.)
E is the set of edges. An edge is a pair of vertices: (u, v).
Edges can be labeled with a weight:
6-Graphs
10
Concepts: Directedness
In a directed graph, the edges are “one-way.” So an edge (u, v)
means you can go from u to v, but not vice versa.
In an undirected graph, there is no direction on the edges: you can go
either way. (Also, no self-loops.)
6-Graphs
a self-loop
Concepts: Adjacency
Two vertices are adjacent if there is an edge between them.
For a directed graph, u is adjacent to v iff there is an edge (v, u).
6-Graphs
u w
v
u is adjacent to v.
v is adjacent to u and w.
w is adjacent to v.
u w
v
u is adjacent to v.
v is adjacent to w.
Concepts: Degree
Undirected graph: The degree of a vertex is the number of edges
touching it.
For a directed graph, the in-degree is the number of edges entering
the vertex, and the out-degree is the number leaving it. The degree is
the in-degree + the out-degree.
6-Graphs
degree 4
in-degree 2, out-degree 1
Concepts: Path
A path is a sequence of adjacent vertices. The length of a path is the
number of edges it contains, i.e. one less than the number of vertices.
We write u ⇒ v if there is path from u to v. We say v is reachable
from u.
6-Graphs
1
2
3
4
Is there a path from 1 to 4?
What is its length?
What about from 4 to 1?
How many paths are there from 2 to
3? From 2 to 2? From 1 to 1?
Concepts: Cycle
•A cycle is a path of length at least 1 from a vertex to itself.
•A graph with no cycles is acyclic.
•A path with no cycles is a simple path.
•The path <2, 3, 4, 2> is a cycle.
6-Graphs
1
2
3
4
Concepts: Connectedness
•An undirected graph is connected iff there is a path between any two
vertices.
•The adjacency graph of U.S. states has three connected components.
Name them.
•(We say a directed graph is strongly connected iff there is a path
between any two vertices.)
6-Graphs
An unconnected graph with three
connected components.
ADJACENCY MATRIX
REPRESENTATION
• 1 2 3 4
1 1 1 1 1
2 1 0 0 0
3 0 1 0 1
4 0 1 1 0
ADJACENCY LIST
REPRESENTATION
 1 -> 1 -> 2 -> 3 -> 4
2 -> 1
3 -> 2 -> 4
4 -> 2 -> 3
GUIDED READING
ASSESSMENT
1. Which of the following statements is true?
A. A graph can drawn on paper in only one
way.
B. Graph vertices may be linked in any
manner.
C. A graph must have at least one vertex.
D. A graph must have at least one edge.

CONTD..
2. Suppose you have a game with 5 coins in
a row and each coin can be heads or tails.
What number of vertices might you expect to
find in the state graph?
A. 7
B. 10
C. 25
D. 32
CONTD..
3. Why is the state graph for tic-tac-toe a
directed graph rather than an undirected
graph?
A. Once a move is made, it cannot be
unmade.
B. There is an odd number of vertices.
C. There is an odd number of edges.
D. There is more than one player in the
game.
CONTD..
4. A simple graph has no loops. What other
property must a simple graph have?
A. It must be directed.
B. It must be undirected.
C. It must have at least one vertex.
D. It must have no multiple edges.
CONTD..
5. Suppose you have a directed graph
representing all the flights that an airline flies.
What algorithm might be used to find the best
sequence of connections from one city to
another?
A. Breadth first search.
B. Depth first search.
C. A cycle-finding algorithm.
D. A shortest-path algorithm.

More Related Content

What's hot

Graph in Data Structure
Graph in Data StructureGraph in Data Structure
Graph in Data StructureProf Ansari
 
Graphs in data structure
Graphs in data structureGraphs in data structure
Graphs in data structurehamza javed
 
Adjacency list
Adjacency listAdjacency list
Adjacency listStefi Yu
 
Application Of Graph Data Structure
Application Of Graph Data StructureApplication Of Graph Data Structure
Application Of Graph Data StructureGaurang Dobariya
 
Data structure computer graphs
Data structure computer graphsData structure computer graphs
Data structure computer graphsKumar
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structureAbrish06
 
Graph representation
Graph representationGraph representation
Graph representationTech_MX
 
Data Structure Graph DMZ #DMZone
Data Structure Graph DMZ #DMZoneData Structure Graph DMZ #DMZone
Data Structure Graph DMZ #DMZoneDoug Needham
 
Lecture 16 graph introduction
Lecture 16 graph introductionLecture 16 graph introduction
Lecture 16 graph introductionAbirami A
 
Graphs in c language
Graphs in c languageGraphs in c language
Graphs in c languageSARITHA REDDY
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - GraphMadhu Bala
 
Graphs in data structures
Graphs in data structuresGraphs in data structures
Graphs in data structuresSavit Chandra
 
Talk on Graph Theory - I
Talk on Graph Theory - ITalk on Graph Theory - I
Talk on Graph Theory - IAnirudh Raja
 
Graph (Data structure)
Graph (Data structure) Graph (Data structure)
Graph (Data structure) shamiur rahman
 
Matrix representation of graph
Matrix representation of graphMatrix representation of graph
Matrix representation of graphRounak Biswas
 
Skiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strcturesSkiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strctureszukun
 

What's hot (20)

Graph in Data Structure
Graph in Data StructureGraph in Data Structure
Graph in Data Structure
 
Graphs in data structure
Graphs in data structureGraphs in data structure
Graphs in data structure
 
Adjacency list
Adjacency listAdjacency list
Adjacency list
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data Structure
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Application Of Graph Data Structure
Application Of Graph Data StructureApplication Of Graph Data Structure
Application Of Graph Data Structure
 
Graph data structure and algorithms
Graph data structure and algorithmsGraph data structure and algorithms
Graph data structure and algorithms
 
Data structure computer graphs
Data structure computer graphsData structure computer graphs
Data structure computer graphs
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
Graph representation
Graph representationGraph representation
Graph representation
 
Data Structure Graph DMZ #DMZone
Data Structure Graph DMZ #DMZoneData Structure Graph DMZ #DMZone
Data Structure Graph DMZ #DMZone
 
Graphs data Structure
Graphs data StructureGraphs data Structure
Graphs data Structure
 
Lecture 16 graph introduction
Lecture 16 graph introductionLecture 16 graph introduction
Lecture 16 graph introduction
 
Graphs in c language
Graphs in c languageGraphs in c language
Graphs in c language
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
Graphs in data structures
Graphs in data structuresGraphs in data structures
Graphs in data structures
 
Talk on Graph Theory - I
Talk on Graph Theory - ITalk on Graph Theory - I
Talk on Graph Theory - I
 
Graph (Data structure)
Graph (Data structure) Graph (Data structure)
Graph (Data structure)
 
Matrix representation of graph
Matrix representation of graphMatrix representation of graph
Matrix representation of graph
 
Skiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strcturesSkiena algorithm 2007 lecture10 graph data strctures
Skiena algorithm 2007 lecture10 graph data strctures
 

Viewers also liked

1.10.association mining 2
1.10.association mining 21.10.association mining 2
1.10.association mining 2Krish_ver2
 
문제는 한글이 잘 구현되는가?
문제는 한글이 잘 구현되는가?문제는 한글이 잘 구현되는가?
문제는 한글이 잘 구현되는가?Choi Man Dream
 
CV Belinda Wahl 2015
CV Belinda Wahl 2015CV Belinda Wahl 2015
CV Belinda Wahl 2015Belinda Wahl
 
5.2 divede and conquer 03
5.2 divede and conquer 035.2 divede and conquer 03
5.2 divede and conquer 03Krish_ver2
 
nhận thiết kế clip quảng cáo giá tốt
nhận thiết kế clip quảng cáo giá tốtnhận thiết kế clip quảng cáo giá tốt
nhận thiết kế clip quảng cáo giá tốtraul110
 
160607 14 sw교육_강의안
160607 14 sw교육_강의안160607 14 sw교육_강의안
160607 14 sw교육_강의안Choi Man Dream
 
5.4 randomized datastructures
5.4 randomized datastructures5.4 randomized datastructures
5.4 randomized datastructuresKrish_ver2
 
평범한 이야기[Intro: 2015 의기제]
평범한 이야기[Intro: 2015 의기제]평범한 이야기[Intro: 2015 의기제]
평범한 이야기[Intro: 2015 의기제]대호 이
 
trabajo de cultural
trabajo de culturaltrabajo de cultural
trabajo de culturalargelures
 
2.4 mst kruskal’s
2.4 mst  kruskal’s 2.4 mst  kruskal’s
2.4 mst kruskal’s Krish_ver2
 
1.9 b trees eg 03
1.9 b trees eg 031.9 b trees eg 03
1.9 b trees eg 03Krish_ver2
 
5.3 dyn algo-i
5.3 dyn algo-i5.3 dyn algo-i
5.3 dyn algo-iKrish_ver2
 
1.9 b trees 02
1.9 b trees 021.9 b trees 02
1.9 b trees 02Krish_ver2
 

Viewers also liked (20)

1.10.association mining 2
1.10.association mining 21.10.association mining 2
1.10.association mining 2
 
문제는 한글이 잘 구현되는가?
문제는 한글이 잘 구현되는가?문제는 한글이 잘 구현되는가?
문제는 한글이 잘 구현되는가?
 
CV Belinda Wahl 2015
CV Belinda Wahl 2015CV Belinda Wahl 2015
CV Belinda Wahl 2015
 
5.2 divede and conquer 03
5.2 divede and conquer 035.2 divede and conquer 03
5.2 divede and conquer 03
 
nhận thiết kế clip quảng cáo giá tốt
nhận thiết kế clip quảng cáo giá tốtnhận thiết kế clip quảng cáo giá tốt
nhận thiết kế clip quảng cáo giá tốt
 
РЕКЛАМНЫЕ МОДЕЛИ
РЕКЛАМНЫЕ МОДЕЛИРЕКЛАМНЫЕ МОДЕЛИ
РЕКЛАМНЫЕ МОДЕЛИ
 
RESUME-ARITRA BHOWMIK
RESUME-ARITRA BHOWMIKRESUME-ARITRA BHOWMIK
RESUME-ARITRA BHOWMIK
 
160607 14 sw교육_강의안
160607 14 sw교육_강의안160607 14 sw교육_강의안
160607 14 sw교육_강의안
 
Online Trading Concepts
Online Trading ConceptsOnline Trading Concepts
Online Trading Concepts
 
5.4 randomized datastructures
5.4 randomized datastructures5.4 randomized datastructures
5.4 randomized datastructures
 
4.2 bst 02
4.2 bst 024.2 bst 02
4.2 bst 02
 
평범한 이야기[Intro: 2015 의기제]
평범한 이야기[Intro: 2015 의기제]평범한 이야기[Intro: 2015 의기제]
평범한 이야기[Intro: 2015 의기제]
 
4.1 webminig
4.1 webminig 4.1 webminig
4.1 webminig
 
trabajo de cultural
trabajo de culturaltrabajo de cultural
trabajo de cultural
 
2.4 mst kruskal’s
2.4 mst  kruskal’s 2.4 mst  kruskal’s
2.4 mst kruskal’s
 
1.9 b trees eg 03
1.9 b trees eg 031.9 b trees eg 03
1.9 b trees eg 03
 
5.3 dyn algo-i
5.3 dyn algo-i5.3 dyn algo-i
5.3 dyn algo-i
 
4.4 hashing02
4.4 hashing024.4 hashing02
4.4 hashing02
 
1.9 b trees 02
1.9 b trees 021.9 b trees 02
1.9 b trees 02
 
4.2 bst 03
4.2 bst 034.2 bst 03
4.2 bst 03
 

Similar to 2.1 graph basic

Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx pptDhruvilSTATUS
 
Graphs (Models & Terminology)
Graphs (Models & Terminology)Graphs (Models & Terminology)
Graphs (Models & Terminology)zunaira saleem
 
Graph Representation, DFS and BFS Presentation.pptx
Graph Representation, DFS and BFS Presentation.pptxGraph Representation, DFS and BFS Presentation.pptx
Graph Representation, DFS and BFS Presentation.pptxbashirabdullah789
 
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++ programMuhammad Danish Badar
 
358 33 powerpoint-slides_13-graphs_chapter-13
358 33 powerpoint-slides_13-graphs_chapter-13358 33 powerpoint-slides_13-graphs_chapter-13
358 33 powerpoint-slides_13-graphs_chapter-13sumitbardhan
 
Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2showslidedump
 
graph.pptx
graph.pptxgraph.pptx
graph.pptxhijigaf
 
Lecture 5b graphs and hashing
Lecture 5b graphs and hashingLecture 5b graphs and hashing
Lecture 5b graphs and hashingVictor Palmar
 
8.-Graphs information technologies graph
8.-Graphs information technologies graph8.-Graphs information technologies graph
8.-Graphs information technologies graphiloveyoucarlo0923
 
Class01_Computer_Contest_Level_3_Notes_Sep_07 - Copy.pdf
Class01_Computer_Contest_Level_3_Notes_Sep_07 - Copy.pdfClass01_Computer_Contest_Level_3_Notes_Sep_07 - Copy.pdf
Class01_Computer_Contest_Level_3_Notes_Sep_07 - Copy.pdfChristianKapsales1
 
Graph ASS DBATU.pptx
Graph ASS DBATU.pptxGraph ASS DBATU.pptx
Graph ASS DBATU.pptxARVIND SARDAR
 

Similar to 2.1 graph basic (20)

Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx ppt
 
Graphs (Models & Terminology)
Graphs (Models & Terminology)Graphs (Models & Terminology)
Graphs (Models & Terminology)
 
Graph Representation, DFS and BFS Presentation.pptx
Graph Representation, DFS and BFS Presentation.pptxGraph Representation, DFS and BFS Presentation.pptx
Graph Representation, DFS and BFS Presentation.pptx
 
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
 
Graphs.pptx
Graphs.pptxGraphs.pptx
Graphs.pptx
 
Unit 2: All
Unit 2: AllUnit 2: All
Unit 2: All
 
Graph
GraphGraph
Graph
 
358 33 powerpoint-slides_13-graphs_chapter-13
358 33 powerpoint-slides_13-graphs_chapter-13358 33 powerpoint-slides_13-graphs_chapter-13
358 33 powerpoint-slides_13-graphs_chapter-13
 
Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2
 
Spanningtreesppt
SpanningtreespptSpanningtreesppt
Spanningtreesppt
 
graph.pptx
graph.pptxgraph.pptx
graph.pptx
 
Lecture 5b graphs and hashing
Lecture 5b graphs and hashingLecture 5b graphs and hashing
Lecture 5b graphs and hashing
 
Data structure
Data structureData structure
Data structure
 
logic.pptx
logic.pptxlogic.pptx
logic.pptx
 
8.-Graphs information technologies graph
8.-Graphs information technologies graph8.-Graphs information technologies graph
8.-Graphs information technologies graph
 
Class01_Computer_Contest_Level_3_Notes_Sep_07 - Copy.pdf
Class01_Computer_Contest_Level_3_Notes_Sep_07 - Copy.pdfClass01_Computer_Contest_Level_3_Notes_Sep_07 - Copy.pdf
Class01_Computer_Contest_Level_3_Notes_Sep_07 - Copy.pdf
 
DATA STRUCTURES.pptx
DATA STRUCTURES.pptxDATA STRUCTURES.pptx
DATA STRUCTURES.pptx
 
Graph ASS DBATU.pptx
Graph ASS DBATU.pptxGraph ASS DBATU.pptx
Graph ASS DBATU.pptx
 
Graphs
GraphsGraphs
Graphs
 
graph ASS (1).ppt
graph ASS (1).pptgraph ASS (1).ppt
graph ASS (1).ppt
 

More from Krish_ver2

5.5 back tracking
5.5 back tracking5.5 back tracking
5.5 back trackingKrish_ver2
 
5.5 back track
5.5 back track5.5 back track
5.5 back trackKrish_ver2
 
5.5 back tracking 02
5.5 back tracking 025.5 back tracking 02
5.5 back tracking 02Krish_ver2
 
5.4 randomized datastructures
5.4 randomized datastructures5.4 randomized datastructures
5.4 randomized datastructuresKrish_ver2
 
5.4 randamized algorithm
5.4 randamized algorithm5.4 randamized algorithm
5.4 randamized algorithmKrish_ver2
 
5.3 dynamic programming 03
5.3 dynamic programming 035.3 dynamic programming 03
5.3 dynamic programming 03Krish_ver2
 
5.3 dynamic programming
5.3 dynamic programming5.3 dynamic programming
5.3 dynamic programmingKrish_ver2
 
5.2 divede and conquer 03
5.2 divede and conquer 035.2 divede and conquer 03
5.2 divede and conquer 03Krish_ver2
 
5.2 divide and conquer
5.2 divide and conquer5.2 divide and conquer
5.2 divide and conquerKrish_ver2
 
5.1 greedyyy 02
5.1 greedyyy 025.1 greedyyy 02
5.1 greedyyy 02Krish_ver2
 
4.4 hashing ext
4.4 hashing  ext4.4 hashing  ext
4.4 hashing extKrish_ver2
 
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashingKrish_ver2
 
4.1 sequentioal search
4.1 sequentioal search4.1 sequentioal search
4.1 sequentioal searchKrish_ver2
 
3.9 external sorting
3.9 external sorting3.9 external sorting
3.9 external sortingKrish_ver2
 
3.8 quick sort
3.8 quick sort3.8 quick sort
3.8 quick sortKrish_ver2
 

More from Krish_ver2 (20)

5.5 back tracking
5.5 back tracking5.5 back tracking
5.5 back tracking
 
5.5 back track
5.5 back track5.5 back track
5.5 back track
 
5.5 back tracking 02
5.5 back tracking 025.5 back tracking 02
5.5 back tracking 02
 
5.4 randomized datastructures
5.4 randomized datastructures5.4 randomized datastructures
5.4 randomized datastructures
 
5.4 randamized algorithm
5.4 randamized algorithm5.4 randamized algorithm
5.4 randamized algorithm
 
5.3 dynamic programming 03
5.3 dynamic programming 035.3 dynamic programming 03
5.3 dynamic programming 03
 
5.3 dynamic programming
5.3 dynamic programming5.3 dynamic programming
5.3 dynamic programming
 
5.2 divede and conquer 03
5.2 divede and conquer 035.2 divede and conquer 03
5.2 divede and conquer 03
 
5.2 divide and conquer
5.2 divide and conquer5.2 divide and conquer
5.2 divide and conquer
 
5.1 greedyyy 02
5.1 greedyyy 025.1 greedyyy 02
5.1 greedyyy 02
 
5.1 greedy
5.1 greedy5.1 greedy
5.1 greedy
 
5.1 greedy 03
5.1 greedy 035.1 greedy 03
5.1 greedy 03
 
4.4 hashing
4.4 hashing4.4 hashing
4.4 hashing
 
4.4 hashing ext
4.4 hashing  ext4.4 hashing  ext
4.4 hashing ext
 
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashing
 
4.2 bst
4.2 bst4.2 bst
4.2 bst
 
4.1 sequentioal search
4.1 sequentioal search4.1 sequentioal search
4.1 sequentioal search
 
3.9 external sorting
3.9 external sorting3.9 external sorting
3.9 external sorting
 
3.8 quicksort
3.8 quicksort3.8 quicksort
3.8 quicksort
 
3.8 quick sort
3.8 quick sort3.8 quick sort
3.8 quick sort
 

Recently uploaded

Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
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
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline 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
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 

Recently uploaded (20)

Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
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
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
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
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 

2.1 graph basic

  • 1. Graph – Basic concepts
  • 2. Basic Concepts A graph is an ordered pair (V, E). V is the set of vertices. (You can think of them as integers 1, 2, …, n.) E is the set of edges. An edge is a pair of vertices: (u, v). Edges can be labeled with a weight: 6-Graphs 10
  • 3. Concepts: Directedness In a directed graph, the edges are “one-way.” So an edge (u, v) means you can go from u to v, but not vice versa. In an undirected graph, there is no direction on the edges: you can go either way. (Also, no self-loops.) 6-Graphs a self-loop
  • 4. Concepts: Adjacency Two vertices are adjacent if there is an edge between them. For a directed graph, u is adjacent to v iff there is an edge (v, u). 6-Graphs u w v u is adjacent to v. v is adjacent to u and w. w is adjacent to v. u w v u is adjacent to v. v is adjacent to w.
  • 5. Concepts: Degree Undirected graph: The degree of a vertex is the number of edges touching it. For a directed graph, the in-degree is the number of edges entering the vertex, and the out-degree is the number leaving it. The degree is the in-degree + the out-degree. 6-Graphs degree 4 in-degree 2, out-degree 1
  • 6. Concepts: Path A path is a sequence of adjacent vertices. The length of a path is the number of edges it contains, i.e. one less than the number of vertices. We write u ⇒ v if there is path from u to v. We say v is reachable from u. 6-Graphs 1 2 3 4 Is there a path from 1 to 4? What is its length? What about from 4 to 1? How many paths are there from 2 to 3? From 2 to 2? From 1 to 1?
  • 7. Concepts: Cycle •A cycle is a path of length at least 1 from a vertex to itself. •A graph with no cycles is acyclic. •A path with no cycles is a simple path. •The path <2, 3, 4, 2> is a cycle. 6-Graphs 1 2 3 4
  • 8. Concepts: Connectedness •An undirected graph is connected iff there is a path between any two vertices. •The adjacency graph of U.S. states has three connected components. Name them. •(We say a directed graph is strongly connected iff there is a path between any two vertices.) 6-Graphs An unconnected graph with three connected components.
  • 9. ADJACENCY MATRIX REPRESENTATION • 1 2 3 4 1 1 1 1 1 2 1 0 0 0 3 0 1 0 1 4 0 1 1 0
  • 10. ADJACENCY LIST REPRESENTATION  1 -> 1 -> 2 -> 3 -> 4 2 -> 1 3 -> 2 -> 4 4 -> 2 -> 3
  • 12.
  • 13. ASSESSMENT 1. Which of the following statements is true? A. A graph can drawn on paper in only one way. B. Graph vertices may be linked in any manner. C. A graph must have at least one vertex. D. A graph must have at least one edge. 
  • 14. CONTD.. 2. Suppose you have a game with 5 coins in a row and each coin can be heads or tails. What number of vertices might you expect to find in the state graph? A. 7 B. 10 C. 25 D. 32
  • 15. CONTD.. 3. Why is the state graph for tic-tac-toe a directed graph rather than an undirected graph? A. Once a move is made, it cannot be unmade. B. There is an odd number of vertices. C. There is an odd number of edges. D. There is more than one player in the game.
  • 16. CONTD.. 4. A simple graph has no loops. What other property must a simple graph have? A. It must be directed. B. It must be undirected. C. It must have at least one vertex. D. It must have no multiple edges.
  • 17. CONTD.. 5. Suppose you have a directed graph representing all the flights that an airline flies. What algorithm might be used to find the best sequence of connections from one city to another? A. Breadth first search. B. Depth first search. C. A cycle-finding algorithm. D. A shortest-path algorithm.