What is Graphs ?

( tap to know )

  • Graphs are used to solve real-life problems that involve representation of the problem space as a network. Examples of networks include telephone networks, circuit networks, social networks (like LinkedIn, Facebook etc.).

  • A graph is a common data structure that consists of a finite set of nodes (or vertices) and a set of edges connecting them.

  • A pair (x,y) is referred to as an edge, which communicates that the x vertex connects to the y vertex.

Types of graphs:

  • Undirected Graph

  • Directed Graph

Directed Graph :

  • A directed graph is a graph in which all the edges are uni-directional i.e. the edges point in a single direction.

Undirected Graph :

  • An undirected graph is a graph in which all the edges are bi-directional i.e. the edges do not point in any specific direction.


There are alot of representations of graphs are available, But most popular representations are :

  • Matrix Representation.

  • Adjacency List Representation.


Some Real World Applications :

  • Graph theory is used to find shortest path in road or a network.

  • In Google Maps, various locations are represented as vertices or nodes and the roads are represented as edges and graph theory is used to find the shortest path between two nodes.

  • Graphs are used to define the flow of computation.

  • Graphs are used to represent networks of communication.

  • Graph transformation systems work on rule-based in-memory manipulation of graphs. Graph databases ensure transaction-safe, persistent storing and querying of graph structured data.

  • Graphs are used to represent data organization.


Graphs may Look Like This :

Auto

Manual

Speed Of Execution :

Delay 3sec

BFS :

Values

1

2

5

6

9

10

Visited

0

0

0

0

0

0

White Board


1) Start Traversal !

Queue :

Pointer :

0