Section 1.4: Graphs and Trees
[Pages:34]Section 1.4: Graphs and Trees
A graph is a set of objects (called vertices or nodes) and edges between pairs of nodes.
Ve Co Eq
G S
F Br
Pe
Bo Pa
U
Ch
A
Vertices = {Ve, G, S, F, Br, Co, Eq, Pe, Bo,Pa, Ch, A, U} Edges = { {Ve,G}, {Ve,Br}, ... }
CS340-Discrete Structures
Section 1.4
Page 1
A path from vertex x0 to xn is a sequence of edges x0, x1, ..., xn, where there is an edge from xi-1 to xi for 1in.
The length of a path is the number of edges in it.
Ve Co Eq
G S
F Br
Pe
Bo Pa
U
A path from Pe to Br
Ch
A
A cycle is a path that begins and ends at the same vertex and has no repeated edges.
CS340-Discrete Structures
Section 1.4
Page 2
The sequence Co,Br,G,Ve,Co is a cycle.
Ve
G
The sequence S,F,S is not a cycle,
since edge {S,F} occurs twice.
Co
In-class quiz: What is the longest Eq
path from Bo to F
with distinct edges and no cylces?
Pe
S
F Br
Bo Pa
U
Ch
A
CS340-Discrete Structures
Section 1.4
Page 3
The sequence Co,Br,G,Ve,Co is a cycle.
Ve
G
The sequence S,F,S is not a cycle,
since edge {S,F} occurs twice.
Co
In-class quiz: What is the longest Eq
path from Bo to F
with distinct edges and no cylces?
Pe
S
F Br
Bo Pa
U
Ch
A
CS340-Discrete Structures
Section 1.4
Page 4
The sequence Co,Br,G,Ve,Co is a cycle.
The sequence S,F,S is not a cycle, since edge {S,F} occurs twice.
In-class quiz: What is the longest Eq path from Bo to F with distinct edges and no cylces?
A graph is n-colorable if its vertices can be colored using n different colors such that adjacent vertices have different colors.
The chromatic number of a graph is the smallest such n.
Ve Co
G S
F Br
Pe
Bo Pa
U
Ch
A
In-class quiz: What is the chromatic color of this graph? i.e., how many colors does it take to color this graph?
CS340-Discrete Structures
Section 1.4
Page 5
The sequence Co,Br,G,Ve,Co is a cycle.
The sequence S,F,S is not a cycle, since edge {S,F} occurs twice.
In-class quiz: What is the longest Eq path from Bo to F with distinct edges and no cylces?
A graph is n-colorable if its vertices can be colored using n different colors such that adjacent vertices have different colors.
The chromatic number of a graph is the smallest such n.
Ve Co
G S
F Br
Pe
Bo Pa
U
Ch
A
In-class quiz: What is the chromatic color of this graph? i.e., how many colors does it take to color this graph?
A planar graph can be drawn on a 2-D plane without edges crossing. Theorem: All planar graphs can be colored with 4 (or fewer) colors.
CS340-Discrete Structures
Section 1.4
Page 6
Graph Traversals
A graph traversal starts at some vertex v and visits all vertices without visiting any vertex more than once. (We assume connectedness: all vertices are reachable from v.)
Breadth-First Traversal ? First visit v. ? Then visit all vertices reachable from v with a path length of 1. ? Then visit all vertices reachable from v with a path length of 2. (... not already visited earlier) ? And so on.
Ve Co Eq
G S
F Br
Pe
Bo Pa
U
CS340-Discrete Structures
Section 1.4
Ch
A
Page 7
Graph Traversals
A graph traversal starts at some vertex v and visits all vertices without visiting any vertex more than once. (We assume connectedness: all vertices are reachable from v.)
Breadth-First Traversal ? First visit v. ? Then visit all vertices reachable from v with a path length of 1. ? Then visit all vertices reachable from v with a path length of 2. (... not already visited earlier) ? And so on.
Ve Co Eq
G S
F Br
Example: v=Bo Bo
Pe
Bo Pa
U
CS340-Discrete Structures
Section 1.4
Ch
A
Page 8
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- course outline testout
- section 1 quiz aggression appeasement and war chapter 31
- section 2 physics quiz answers holt tvdots
- chapter 29 section 1 quiz
- ottoman section quiz answer
- chapter 12 section 1 quiz gross domestic product
- section 1 4 graphs and trees
- quiz section schedule pbio 376 winter 2022 topic
- chapter 18 section 1 quiz origins if cold war
- csc 120 r section quiz 1 with answers
Related searches
- leaves and trees preschool theme
- the nature of science section 1 answers
- 1 8 to 1 4 mile conversion
- 1 4 nouns as objects and object complements
- 1 2 of 1 4 tsp
- 1 4 1 2 lineset
- 14th amendment section 1 summary
- 14th amendment section 1 meaning
- compare and contrast bar graphs and histograms
- 1 1 graphs and graphing utilities
- article 1 section 1 constitution
- 1 4 tap and die