In computer science, a graph is an abstract data type that is meant to implement the undirected graph and directed graph concepts from the field of graph theory within mathematics.
2. PRESENTATION ON GRAPH
Group Members:
1. Hashibur Rahman Anik ID: 162-15-1032
2. Mohammad Salim Hosen ID: 162-15-1044
3. Rifat Rahman ID: 162-15-1049
4. Yeasin Hossain Emran ID: 162-15-1037
3. GRAPH THEORY
• A graph is a collection of vertices that are connected by edges. Some graphs can be
directed, which means the lines have an arrow and only go in one direction. some
graphs can have no edges at all, in others the edges could overlap, and there can be
many edges coming out of the same vertex.
• Example of Graph:
4. PROPERTIES OF GRAPH:
• Neighbors: Two vertices u and v in an undirected graph G are called adjacent (or
neighbors) in G if u and v are endpoints of an edge e of G.
• Neighborhood: The set of all neighbors of a vertex v of G = (V ,E), denoted by N(v), is
called the neighborhood of v.
• The degree of a vertex in an undirected graph is the number of edges incident with
it.
• A vertex of degree zero is called isolated.
• A vertex is pendant if and only if it has degree one.
• A path starting and ending at one vertex is called a loop on this vertex.
5. SOME TYPES OF GRAPH
Directed Graph Complete, Cycle
& Undirected
Graph
Wheel
Graph
Bipartite Graph
6. HANDSHAKING THEOREM:
• Let G = (V ,E) be an undirected graph with m edges. Then
• In any graph, the sum of all the vertex-degree is equal to twice the number of edges.
7. EXAMPLE OF HANDSHAKING THEOREM
• Suppose You have been invited to an birthday party. After a rousing celebration the
guests get ready to leave, and everyone shakes hands with everyone else. How many
handshakes are there in total?
• Suppose that, including yourself and the host, there are 5 people present.
• Each of the 5 people at the party shakes hands with 4 others.
• Some people may think that Each of the 5 people at the party shakes hands with 4
others. That makes 5 × 4 = 20 handshakes in total. But this is wrong.
8. HANDSHAKING THEOREM
• If we represent the handshakes using a graph: every person is a vertex, and every
handshake is an edge then there are 5 vertex and 4 edges. So now we can easily find
the number of handshakes using the handshaking formula.
• So the result will be, 2E = 4x5 and E = 10 handshakes in total
9. EULER PATH AND CIRCUIT
• An Euler path is a path that uses every edge in a graph with no
repeats. Being a path, it does not have to return to the starting
vertex.
• An Euler circuit is a circuit that uses every edge in a graph with
no repeats. Being a circuit it must start and end at the same
vertex.
10. EULER PATH AND CIRCUIT CONDITIONS:
• Euler Path:
• A graph will contain an Euler path if it contains at most two vertices of odd degree.
• Euler Circuit:
• A graph will Contain Euler Circuit if all vertices have even number of degree.
PATH: c, d, b, c, a, b CIRCUIT: a, g, c, b, g, e,
11. APPLICATION OF EULER CIRCUIT
• Suppose a police officer wants to patrol neighborhood on foot by walking as little
possible. The ideal solution for this could be a circuit that covers every street with no
repeats and the officer will be returned where he had started from.
If above graph is the area he could visit: A, B, C, D, E, B, E, F, A
12. HAMILTON PATH AND CIRCUIT
• A Hamilton path visits every vertex once with no
repeats, but does not have to start and end at the
same vertex.
• A Hamilton circuit is a circuit that visits every
vertex once with no repeats. Being a circuit it
must start and end at the same vertex.
13. HAMILTON PATH AND CIRCUIT CONDITIONS
• Path:
• No repeat vertex but touch all.
• It is not compulsory to touch all edges
• Circuit:
• No odd number of vertex
• Starting point and ending point should be same.
Path: a, b, c, d.
circuit: a, b, c, d, e, a.
14. HAMILTON CIRCUIT APPLICATION:
• Suppose a pizza delivery boy wants to serve pizza on each location then Hamilton
path or circuit is the best way to express this situation.
15. LINEAR ALGEBRA IN GRAPH THEORY
• Graphs can be sometimes very complicated. So one needs to find more practical
ways to represent them. Matrices are a very useful way of studying graphs, since
they turn the picture into numbers, and then one can use techniques from linear
algebra. Here is a example of adjacent matrix used in graph,
16. DIJKSTRA’S SHORTEST PATH ALGORITHM
• The objective of the algorithm is to find the shortest path from one source to
another.
• This algorithm has multiple application in real life. Mainly in computer networking
or commercial shipping. We use this algorithm when we send something from one
place to another. If there is multiple way to go there we find the shortest path.
• Each stop in the graph will be denoted as vertex and each link will be called edge
would have a specific weight.
17. EXAMPLE
• Suppose we want to go from A to H in above graph. So what would be the shortest
path from A to H. We can use Dijkstra’s algorithm to find it.