
ET210x: Data Structures & Algorithms
Đào Trung Kiên @ MICA Institute & Dept. of Comm. Eng., SEEE, Hanoi Univ. of Science and Technology
1
Weeks 15+16: Graphs
❑Definitions
❑Implementation
❑Traversal, search, shortest path

ET210x: Data Structures & Algorithms
Đào Trung Kiên @ MICA Institute & Dept. of Comm. Eng., SEEE, Hanoi Univ. of Science and Technology
2
Overview of Graphs

ET210x: Data Structures & Algorithms
Đào Trung Kiên @ MICA Institute & Dept. of Comm. Eng., SEEE, Hanoi Univ. of Science and Technology
Introduction
Traffic networks
Communication networks
Social networks
Semantic representation
Electrical circuits
Chemical molecular structures
…
3

ET210x: Data Structures & Algorithms
Đào Trung Kiên @ MICA Institute & Dept. of Comm. Eng., SEEE, Hanoi Univ. of Science and Technology
Graph is a pair: 𝐺 = 𝑉, 𝐸 , where:
𝑉 = 𝑣1, 𝑣2, … , 𝑣nare vertices, or nodes
𝐸 = 𝑒1, 𝑒2, … , 𝑒mare edges, or connections
𝑒𝑖= 𝑣𝑗, 𝑣kwhere 𝑣𝑗, 𝑣k∈ 𝑉
Definitions
4
Example
𝑉 = 1,2,3,4,5,6
𝐸 = 1,2 , 2,3 , 2,5 , 3,4 , 4,5 , 4,6
Trees are graphs
5
1
2
4
3
6

ET210x: Data Structures & Algorithms
Đào Trung Kiên @ MICA Institute & Dept. of Comm. Eng., SEEE, Hanoi Univ. of Science and Technology
Directivity
Undirected graph: edges are unordered
𝐸1= 1,2 , 1,3 , 2,3
𝑢, 𝑣 ∈ 𝐸 implies that 𝑣, 𝑢 ∈ 𝐸
Directed graph: edges are ordered
𝐸2= 1,2 , 1,3 , 2,3 , 3,2
Trees can be either directed or undirected
5
𝐺1: undirected 𝐺2: directed 𝐺2: directed with
simplified drawing
3
1
23
1
23
1
2

