Graph Representation
Last updated
What is Graph Representation?
A graph can either be represented as an adjacency matrix or an adjacency list.
The adjacency matrix is a 2D array of size V x V where V is the number of vertices in a graph. Let the 2D array be adj[][], a slot adj[i][j] = 1 indicates that there is an edge from vertex i to vertex j.
Adjacency list is an array of vectors. Size of the array is equal to the number of vertices. Let the array be array[]. An entry array[i] represents the list of vertices adjacent to the ith vertex. This representation can also be used to represent a weighted graph. The weights of edges can be represented as lists of pairs.
Free resources to learn Graph Representation
More in stage 3: Asymptotic Notation
Graph Representation: common questions
Can I learn Graph Representation in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Graph Representation in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Graph Representation tutorial for beginners?
It is lesson 39 of 188 in the free Computer Science roadmap, in stage 3, Asymptotic Notation. If you are new to Computer Science, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.