- Data Structures & Algorithms
- DSA - Home
- DSA - Overview
- DSA - Environment Setup

- Algorithm
- DSA - Algorithms Basics
- DSA - Asymptotic Analysis
- DSA - Greedy Algorithms
- DSA - Divide and Conquer
- DSA - Dynamic Programming

- Data Structures
- DSA - Data Structure Basics
- DSA - Array Data Structure

- Stack & Queue
- DSA - Stack
- DSA - Expression Parsing
- DSA - Queue

- Searching Techniques
- DSA - Linear Search
- DSA - Binary Search
- DSA - Interpolation Search
- DSA - Hash Table

- Sorting Techniques
- DSA - Sorting Algorithms
- DSA - Bubble Sort
- DSA - Insertion Sort
- DSA - Selection Sort
- DSA - Merge Sort
- DSA - Shell Sort
- DSA - Quick Sort

- Graph Data Structure
- DSA - Graph Data Structure
- DSA - Depth First Traversal
- DSA - Breadth First Traversal

- Tree Data Structure
- DSA - Tree Data Structure
- DSA - Tree Traversal
- DSA - Binary Search Tree
- DSA - AVL Tree
- DSA - Spanning Tree
- DSA - Heap

- DSA Useful Resources
- DSA - Questions and Answers
- DSA - Quick Guide
- DSA - Useful Resources
- DSA - Discussion

# Graph and its representations

The graph is a non-linear data structures. This represents data using nodes, and their relations using edges. A graph G has two sections. The vertices, and edges. Vertices are represented using set V, and Edges are represented as set E. So the graph notation is G(V,E). Let us see one example to get the idea.

In this graph, there are five vertices and five edges. The edges are directed. As an example, if we choose the edge connecting vertices B and D, the source vertex is B and destination is D. So we can move B to D but not move from D to B.

The graphs are non-linear, and it has no regular structure. To represent a graph in memory, there are few different styles. These styles are −

- Adjacency matrix representation
- Edge list representation
- Adjacency List representation

## Adjacency Matrix Representation

We can represent a graph using Adjacency matrix. The given matrix is an adjacency matrix. It is a binary, square matrix and from ith row to jth column, if there is an edge, that place is marked as 1. When we will try to represent an undirected graph using adjacency matrix, the matrix will be symmetric.

## Edge List Representation

Graphs can be represented using one dimensional array also. This is called the edge list. In this representation there are five edges are present, for each edge the first element is the source and the second one is the destination. For undirected graph representation the number of elements in the edge list will be doubled.

## Adjacency List Representation

This is another type of graph representation. It is called the adjacency list. This representation is based on Linked Lists. In this approach, each Node is holding a list of Nodes, which are Directly connected with that vertices. At the end of list, each node is connected with the null values to tell that it is the end node of that list.

- Related Articles
- Fixed Point and Floating Point Number Representations
- Explain graphical representations of motion.
- Media Representations of Mental Health
- Representations of Social Groups in Media
- Representations of Minority Groups in the Media
- Define ohm's law and its limitations. Also, post graph of ohmic and non-ohmic materials.
- The Effects of Changing Media Representations of Men
- What is two array representations in the symbol table?
- What can you say about the motion of a body if:$(a)$. its displacement-time graph is a straight line?$(b)$. its velocity-time graph is a straight line?
- Edges and Vertices of Graph
- Difference Between Tree and Graph
- Difference between Graph and Tree
- Check if binary representations of two numbers are anagram in Python
- A object moves with uniform positive acceleration. What will be its velocity-time graph.
- What is pictograph and bar graph?