Skip to content
Related Articles

Related Articles

Applications, Advantages and Disadvantages of Graph

View Discussion
Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 25 May, 2022
View Discussion
Improve Article
Save Article

Graph is a non-linear data structure that contains nodes (vertices) and edges. A graph is a collection of set of vertices and edges (formed by connecting two vertices). A graph is defined as G = {V, E} where V is the set of vertices and E is the set of edges.

Graph Representation:

Graph can be represented in the following ways:

  1. Set Representation: Set representation of a graph involves two sets: Set of vertices V = {V1, V2, V3, V4} and set of edges E = {{V1, V2}, {V2, V3}, {V3, V4}, {V4, V1}}. This representation is efficient for memory but does not allow parallel edges.
  2. Sequential Representation: This representation of a graph can be represented by means of matrices: Adjacency Matrix, Incidence matrix and Path matrix.
    • Adjacency Matrix: This matrix includes information about the adjacent nodes. Here, aij = 1 if there is an edge from Vi to Vj otherwise 0. It is a matrix of order V×V.
    • Incidence Matrix: This matrix includes information about the incidence of edges on the nodes. Here, aij = 1 if the jth edge Ej is incident on ith vertex Vi otherwise 0. It is a matrix of order V×E.
    • Path Matrix: This matrix includes information about the simple path between two vertices. Here, Pij = 1 if there is a path from Vi to Vj otherwise 0. It is also called as reachability matrix of graph G.  
  3. Linked Representation: This representation gives the information about the nodes to which a specific node is connected i.e. adjacency lists. This representation gives the adjacency lists of the vertices with the help of array and linked lists. In the adjacency lists, the vertices which are connected with the specific vertex are arranged in the form of lists which is connected to that vertex.

Real-Time Applications of Graph:

  • Graphs are used to represent flow of control in computers.
  • Graphs are used in social networking sites where users act as nodes and connection between them acts as edges.
  • In an operating system, graphs are used as resource allocation graphs.
  • Graphs are used in Google maps to find the shortest route.
  • Graphs are also used in airlines system for effective route optimization. 
  • In-state transition diagrams, the graph is used to represent their states and their transition.
  • In transportation, graphs are used to find the shortest path.
  • In circuits, graphs can be used to represent circuit points as nodes and wires as edges.
  • Graphs are used in solving puzzles with only one solution, such as mazes.
  • Graphs are used in computer networks for Peer to peer (P2P) applications.
  • Graphs basically in the form of DAG(Directed acyclic graph) are used as alternative to blockchain for cryptocurrency. For example crypto like  IOTA, Nano are mainly based on DAG.

Advantages of Graph:

  • By using graphs we can easily find the shortest path, neighbors of the nodes, and many more.
  • Graphs are used to implement algorithms like DFS and BFS.
  • It is used to find minimum spanning tree which has many practical applications.
  • It helps in organizing data.
  • Because of its non-linear structure, helps in understanding complex problems and their visualization.

Disadvantages of Graph:

  • Graphs use lots of pointers which can be complex to handle.
  • It can have large memory complexity.
  • If the graph is represented with an adjacency matrix then it does not allow parallel edges and multiplication of the graph is also difficult. 
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!