GRAPH:
• Defination:
“Graph isthe collection of data item called as nodes and each nodes
are connected to each other with the help of edges.”
N1
N2
N3
N4
E1
E3
E2
E4
3.
REPRESENTATION:
• A graphcan be represented with the help of pair i.e Vertices (Nodes)
and Edges.
• In simple, collection of vertices and edges is called Graph.
4.
Explanation:
• Vertices (A,B, C, D, E)
• Edges (E1, E2, E3, E4, E5, E6)
• G (5,6) A
B C
D E
E1 E2
E4 E5
E6
E3
Directed Graph:
• “Itindicates a specific path from one vertex to other vertex”
Example:
.
A B
C D
7.
UNDIRECTED GRAPH:
• “Itdoes not indicates a specific path from one vertex to other vertex”
Example:
A B
C D
8.
DEMONSTRATION OF ABOVEEXAMPLE:
In this graph, edges are not associated with any direction.
For Example: If an edge exist between A and B vertex then the vertices
can be traversed between A to B and B to A.
9.
TERMINOLOGIES OF GRAPH:
•Path: It is way to reach intial node to terminal node.
E Final State
• A--C—E
• B—C--E
A
B
C
D
E
10.
• Adjacent Node:If node A and B are connected through Edge then A and
B node are called Adjacent Node.
A
E
E
E
E
11.
• Cycle: Ithas no repeated edges and vertices except the first and last
vertices.
• Degree: The degree of nodes indicate the total number of edges
connected to it.
A
B
D
C
12.
• Degree inDirected Graph:
There are two types:
• Indegree
• Outdegree
Degree of A node:
Indegree(o)
Outdegree(3)
A
C
B
D
13.
• Complete Graph:If all the nodes of graph connected to each other then
it is called complete graph.
• Weighted Graph: If edge of a graph are assigned with the value or
weight then it is called weighted graph.
A
B
C
D
1
2
3
A
B C
14.
• Multi-Graph: Ifa graph nodes contain more than two edges then it is
called multiple graph.
• Disconnected Graph: Some vertices are not connected.
A B
E2
E1
A
B
C
D
15.
Applications of Graph:
1.Social Networks
Facebook, Instagram, LinkedIn
People = nodes, relationships = edges
2. Maps & Navigation
Google Maps, GPS
Locations = vertices, routes = edges
3. Computer Networks
Used to represent network connections.
Computers / routers = vertices
Network links = edges
16.
COMMON GRAPH ALGORITHEM(Just for knowledge):
• BFS (Breadth First Search)
• DFS (Depth First Search)
• Dijkstra’s Algorithm
• Kruskal’s Algorithm
• Prim’s Algorithm