WHAT IS GRAPH
PRESENTED BY AYESHA EJAZ
GRAPH:
• Defination:
“Graph is the 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
REPRESENTATION:
• A graph can be represented with the help of pair i.e Vertices (Nodes)
and Edges.
• In simple, collection of vertices and edges is called Graph.
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
TYPES OF GRAPH:
Types:
Graph
Directed
Graph
Undirected
Graph
Directed Graph:
• “It indicates a specific path from one vertex to other vertex”
Example:
.
A B
C D
UNDIRECTED GRAPH:
• “It does not indicates a specific path from one vertex to other vertex”
Example:
A B
C D
DEMONSTRATION OF ABOVE EXAMPLE:
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.
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
• 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
• Cycle: It has 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
• Degree in Directed Graph:
There are two types:
• Indegree
• Outdegree
Degree of A node:
Indegree(o)
Outdegree(3)
A
C
B
D
• 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
• Multi-Graph: If a 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
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
COMMON GRAPH ALGORITHEM (Just for knowledge):
• BFS (Breadth First Search)
• DFS (Depth First Search)
• Dijkstra’s Algorithm
• Kruskal’s Algorithm
• Prim’s Algorithm

DSA PRESENTATION .pptx about graph topic

  • 1.
  • 2.
    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
  • 5.
  • 6.
    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