- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Matrix Representation of Graphs
A graph can be represented using Adjacency Matrix way.
An Adjacency Matrix A[V][V] is a 2D array of size V × V where $V$ is the number of vertices in a undirected graph. If there is an edge between Vx to Vy then the value of A[Vx][Vy]=1 and A[Vy][Vx]=1, otherwise the value will be zero.
For a directed graph, if there is an edge between Vx to Vy, then the value of A[Vx][Vy]=1, otherwise the value will be zero.
Adjacency Matrix of an Undirected Graph
Let us consider the following undirected graph and construct the adjacency matrix −
Adjacency matrix of the above undirected graph will be −
Adjacency Matrix of a Directed Graph
Let us consider the following directed graph and construct its adjacency matrix −
Adjacency matrix of the above directed graph will be −
- Representation of Graphs
- Prim’s Algorithm (Simple Implementation for Adjacency Matrix Representation) in C++
- Basic Concepts of Graphs
- Representation of fractions
- Isomorphism and Homeomorphism of graphs
- Eulerian Graphs
- Hamiltonian Graphs
- Planar Graphs
- Bipartite Graphs
- Strongly Connected Graphs
- Speed Time Graphs
- Representation of Relations using Graph
- Array Representation Of Binary Heap
- Electron dot representation of glucose.
- What are the applications of Bipartite graphs?