Question DSA-GRAPH-0002
EasyWhich representation uses a V × V matrix to store edges?
- A.
Adjacency matrix
- B.
Incidence list
- C.
Show answer and explanation
Answer: A
It takes O(V²) space but answers 'is there an edge u–v?' in O(1).
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Graphs question
Which representation uses a V × V matrix to store edges?
Adjacency matrix
Incidence list
Answer: A
It takes O(V²) space but answers 'is there an edge u–v?' in O(1).
Edge list
Adjacency list