0
0
DSA Typescriptprogramming~5 mins

Adjacency Matrix Representation in DSA Typescript - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is an adjacency matrix in graph representation?
An adjacency matrix is a 2D array used to represent a graph where each cell at row i and column j indicates if there is an edge between vertex i and vertex j.
Click to reveal answer
beginner
How do you represent no edge between two vertices in an adjacency matrix?
You represent no edge by placing 0 (zero) in the cell corresponding to those vertices in the adjacency matrix.
Click to reveal answer
beginner
What is the size of an adjacency matrix for a graph with n vertices?
The adjacency matrix size is n x n, where n is the number of vertices in the graph.
Click to reveal answer
intermediate
How does an adjacency matrix differ for directed and undirected graphs?
In a directed graph, the matrix is not necessarily symmetric because edges have direction. In an undirected graph, the matrix is symmetric because edges go both ways.
Click to reveal answer
beginner
What is the time complexity to check if an edge exists between two vertices using an adjacency matrix?
It is O(1) because you directly access the cell at row i and column j to check for an edge.
Click to reveal answer
What value is stored in an adjacency matrix cell if there is an edge between vertex 2 and vertex 3?
Anull
B1
C-1
D0
What is the size of the adjacency matrix for a graph with 5 vertices?
A5 x 5
B5 x 4
C4 x 4
D1 x 5
Which graph type has a symmetric adjacency matrix?
ADirected graph
BCyclic graph
CWeighted graph
DUndirected graph
What is the time complexity to check if an edge exists between two vertices using an adjacency matrix?
AO(n)
BO(log n)
CO(1)
DO(n^2)
How is no edge represented in an adjacency matrix?
A0
B1
C-1
Dnull
Explain how an adjacency matrix represents a graph and how to interpret its values.
Think of a table where rows and columns are vertices and cells show connections.
You got /5 concepts.
    Describe the difference between adjacency matrices of directed and undirected graphs.
    Consider if edges have direction or go both ways.
    You got /4 concepts.