STEM Interactive Visual Learning Program at TEC-Bridge AI
Adjacency Matrix is a 2D array used to represent a graph. Each cell (i, j) indicates if there is an edge from node i to node j.
Key Characteristics:
Operation | Time Complexity | Space Complexity |
---|---|---|
Add Node | O(V^2) | O(V^2) |
Add Edge | O(1) | O(1) |
Remove Node | O(V^2) | O(V^2) |
Remove Edge | O(1) | O(1) |
Is Connected? | O(V^2) | O(V^2) |
Is Symmetric? | O(V^2) | O(V^2) |
Strengths:
Limitations: