SlideShare a Scribd company logo
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 Structure
Prof Ansari
 
Graphs in data structure
Graphs in data structureGraphs in data structure
Graphs in data structure
hamza javed
 
Adjacency list
Adjacency listAdjacency list
Adjacency listStefi Yu
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data Structure
Afaq Mansoor Khan
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
Rashmi Bhat
 
Application Of Graph Data Structure
Application Of Graph Data StructureApplication Of Graph Data Structure
Application Of Graph Data Structure
Gaurang Dobariya
 
Graph data structure and algorithms
Graph data structure and algorithmsGraph data structure and algorithms
Graph data structure and algorithms
Anandhasilambarasan D
 
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 structure
Abrish06
 
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 #DMZone
Doug Needham
 
Graphs data Structure
Graphs data StructureGraphs data Structure
Graphs data Structure
Mahmoud Alfarra
 
Lecture 16 graph introduction
Lecture 16 graph introductionLecture 16 graph introduction
Lecture 16 graph introduction
Abirami A
 
Graphs in c language
Graphs in c languageGraphs in c language
Graphs in c language
SARITHA REDDY
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
Madhu Bala
 
Graphs in data structures
Graphs in data structuresGraphs in data structures
Graphs in data structures
Savit Chandra
 
Talk on Graph Theory - I
Talk on Graph Theory - ITalk on Graph Theory - I
Talk on Graph Theory - I
Anirudh 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 graph
Rounak 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 2
Krish_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 03
Krish_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
 
Online Trading Concepts
Online Trading ConceptsOnline Trading Concepts
Online Trading Concepts
Fxmoneyworld LTD
 
5.4 randomized datastructures
5.4 randomized datastructures5.4 randomized datastructures
5.4 randomized datastructures
Krish_ver2
 
4.2 bst 02
4.2 bst 024.2 bst 02
4.2 bst 02
Krish_ver2
 
평범한 이야기[Intro: 2015 의기제]
평범한 이야기[Intro: 2015 의기제]평범한 이야기[Intro: 2015 의기제]
평범한 이야기[Intro: 2015 의기제]
대호 이
 
trabajo de cultural
trabajo de culturaltrabajo de cultural
trabajo de cultural
argelures
 
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 03
Krish_ver2
 
5.3 dyn algo-i
5.3 dyn algo-i5.3 dyn algo-i
5.3 dyn algo-i
Krish_ver2
 
4.4 hashing02
4.4 hashing024.4 hashing02
4.4 hashing02
Krish_ver2
 
1.9 b trees 02
1.9 b trees 021.9 b trees 02
1.9 b trees 02
Krish_ver2
 
4.2 bst 03
4.2 bst 034.2 bst 03
4.2 bst 03
Krish_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 ppt
DhruvilSTATUS
 
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.pptx
bashirabdullah789
 
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
Muhammad Danish Badar
 
Graphs.pptx
Graphs.pptxGraphs.pptx
Graphs.pptx
satvikkushwaha1
 
Unit 2: All
Unit 2: AllUnit 2: All
Unit 2: All
Hector Zenil
 
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
sumitbardhan
 
Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2showslidedump
 
Spanningtreesppt
SpanningtreespptSpanningtreesppt
Spanningtreesppt
Jyoshna Cec Cse Staf bejjam
 
graph.pptx
graph.pptxgraph.pptx
graph.pptx
hijigaf
 
Lecture 5b graphs and hashing
Lecture 5b graphs and hashingLecture 5b graphs and hashing
Lecture 5b graphs and hashingVictor Palmar
 
Data structure
Data structureData structure
Data structure
Afzal Hossen
 
8.-Graphs information technologies graph
8.-Graphs information technologies graph8.-Graphs information technologies graph
8.-Graphs information technologies graph
iloveyoucarlo0923
 
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
ChristianKapsales1
 
DATA STRUCTURES.pptx
DATA STRUCTURES.pptxDATA STRUCTURES.pptx
DATA STRUCTURES.pptx
KENNEDY GITHAIGA
 
Graph ASS DBATU.pptx
Graph ASS DBATU.pptxGraph ASS DBATU.pptx
Graph ASS DBATU.pptx
ARVIND SARDAR
 
Graphs
GraphsGraphs
graph ASS (1).ppt
graph ASS (1).pptgraph ASS (1).ppt
graph ASS (1).ppt
ARVIND 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 tracking
Krish_ver2
 
5.5 back track
5.5 back track5.5 back track
5.5 back track
Krish_ver2
 
5.5 back tracking 02
5.5 back tracking 025.5 back tracking 02
5.5 back tracking 02
Krish_ver2
 
5.4 randomized datastructures
5.4 randomized datastructures5.4 randomized datastructures
5.4 randomized datastructures
Krish_ver2
 
5.4 randamized algorithm
5.4 randamized algorithm5.4 randamized algorithm
5.4 randamized algorithm
Krish_ver2
 
5.3 dynamic programming 03
5.3 dynamic programming 035.3 dynamic programming 03
5.3 dynamic programming 03
Krish_ver2
 
5.3 dynamic programming
5.3 dynamic programming5.3 dynamic programming
5.3 dynamic programming
Krish_ver2
 
5.2 divede and conquer 03
5.2 divede and conquer 035.2 divede and conquer 03
5.2 divede and conquer 03
Krish_ver2
 
5.2 divide and conquer
5.2 divide and conquer5.2 divide and conquer
5.2 divide and conquer
Krish_ver2
 
5.1 greedyyy 02
5.1 greedyyy 025.1 greedyyy 02
5.1 greedyyy 02
Krish_ver2
 
5.1 greedy
5.1 greedy5.1 greedy
5.1 greedy
Krish_ver2
 
5.1 greedy 03
5.1 greedy 035.1 greedy 03
5.1 greedy 03
Krish_ver2
 
4.4 hashing
4.4 hashing4.4 hashing
4.4 hashing
Krish_ver2
 
4.4 hashing ext
4.4 hashing  ext4.4 hashing  ext
4.4 hashing ext
Krish_ver2
 
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashing
Krish_ver2
 
4.2 bst
4.2 bst4.2 bst
4.2 bst
Krish_ver2
 
4.1 sequentioal search
4.1 sequentioal search4.1 sequentioal search
4.1 sequentioal search
Krish_ver2
 
3.9 external sorting
3.9 external sorting3.9 external sorting
3.9 external sorting
Krish_ver2
 
3.8 quicksort
3.8 quicksort3.8 quicksort
3.8 quicksort
Krish_ver2
 
3.8 quick sort
3.8 quick sort3.8 quick sort
3.8 quick sort
Krish_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

JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
ShivajiThube2
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 

Recently uploaded (20)

JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 

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.