MATH1920-Graphs, Paths and Circuits PDF
MATH1920-Graphs, Paths and Circuits PDF
MATH1920-Graphs, Paths and Circuits PDF
Graphs
Applications of Graphs:
1. Facebook/ networking websites/social media: Each user is
represented as a vertex and there is an edge between two friends.
2. Google Maps/GPS/Yahoo maps: To find the shortest path
between various locations. Various locations are represented as
vertices and the roads are represented as edges.
3. Google search: There is a hyperlink between two pages on the
internet. Each page is a vertex and the link between two pages is
an edge.
4. Recommendations on e-commerce websites: Consumer-product
pair use graph theory
5. Chemistry: To study molecules
6. Travelling salesman problem: To find connected components in
a graph.
7. Traversal algorithm is used to find shortest path between two
vertices
8. Transportation networks: Highway networks and flight networks
9. Computer network: Local area network, Internet and Web
10. Databases: For representing Entity Relationship(ER)
diagrams in databases.
11. Flight booking portals uses Graph Theory to find out
shortest and cheapest path for you.
12. Finance [http://jonathankinlay.com/2016/09/applications-
graph-theory-finance/]
[Applications of graphs: https://www.youtube.com/watch?v=YONOwpx00MU ]
1
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
2
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
Solution:
Vertex Degree Even/Odd
A 2 Even
B 3 Odd
C 2 even
D 4 even
E 1 Odd
3
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
Solution:
Vertex Degree Even/Odd
A 4 even
B 4 even
C 4 even
D 4 even
E 4 even
Order of graph = Number of vertices = 5
Total degree of the graph = 20
Question: Identify the degree of the vertices of the multigraph,
classify vertices as either even or odd, and give the order of the
graph. Find the total degree of the graph.
4
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
Solution:
Vertex Degree Even/Odd
A 2 Even
B 2 Even
C 5 Odd
D 3 Odd
E 4 Even
F 3 Odd
G 1 Odd
Total degree of the graph = deg(v1) + deg(v2) + … + deg(vn)
= 2(no. of edges of the graph)
Total Degree of the graph = 2+2+5+3+4+3+1 = 2(10) = 20
Links:
Graphs and Trees: Find theory and questions related to the
graphs and trees at the following link:
http://cglab.snu.ac.kr/lectures/091/discrete_math/dm09_slide5.pdf
or open website http://cglab.snu.ac.kr , then, click on spring 2009 discrete
mathematics> graphs and trees in order to find the material.
5
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
Solution:
A B C
A 0 1 1
B 1 0 1
C 1 1 0
6
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
Solution:
7
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
OR
0 1 0 1
𝐴 = [1 2 2 1]
0 2 0 0
1 1 0 2
Question: Find the adjacency matrix of the multigraph.
Solution:
2 1 0 1
𝐴 = [1 0 1 0]
0 1 2 2
1 0 2 0
Solution:
9
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
Solution: Connected
10
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
Solution: Disconnected
Walk, Trail and Path Table:
Repeated Repeated Starting and One
Edge Vertex Ending point: Edge(must)
Same
Walk allowed allowed allowed No
Trail No allowed allowed No
Path No no no No
Closed walk allowed allowed yes No
Circuit No allowed yes Yes
Simple Circuit No First and last yes Yes
only
11
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
e) 𝑣1 𝑣2 𝑣1
f) 𝑣1
g) 𝑣2 𝑣3 𝑣4 𝑣5 𝑣6
Solution:
a Walk: Yes Trail: Yes(v1 Path:No(repeated
to v4) edge)
b Walk: Trail: Path: No
Yes(v1 to No(Repeated
v5) Edge)
c Walk: Yes Trail: Yes Path: No
d Walk: Yes
e Closed walk: Trail: Yes Path: No
Yes
f Closed walk: Trail: Yes Circuit: No
Yes Path: No
g Walk: Yes Trail: Yes Path: Yes
12
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
13
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
[Reference: http://optlab.mcmaster.ca/feng/4O03/Trip.Planning.pdf]
[Reference: http://www.ifp.illinois.edu/~angelia/ge330fall09_shortpath_l17.pdf ]
14
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
15
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
16
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
17
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
18
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
19
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
Figure 1
Solution: a) Height of vertex A = 3
Height of vertex F = 2
b) Preorder traversal = R, G, C, D, A, B, H, E, F
c) Array representation: It is a 𝑛 × 3 array having n rows and 3
columns(indicating the vertex, the left child and the right child).
20
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
Parent Siblings
R G, H
G C, D
D A, B
H E, F
21
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
h) Inorder traversal = C, G, A, D, B, R, E, H, F
Link: Tree Traversals: (Study only Preorder, inorder and
postorder traversals from the following links)
https://www.youtube.com/watch?v=GsrPQ32sPTI
https://www.youtube.com/watch?v=r3xN36so6Jg
https://www.youtube.com/watch?v=z_OwSnFY_5s
https://www.youtube.com/watch?v=9RHO6jU--GU
a) TIN
b) PIN
Solution: a) 11101110
b) 00101110
Question: Find the word represented by the binary strings
22
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
a) 11100110
b) 111110
c) 100001
23
Mathematics for Information Technology II(MATH1920) Graphs, Paths and Circuits
24