Overview
An adjacency matrix is one of several common ways of representing which vertices (nodes) of a graph are adjacent to which other vertices.
Concept
The basic concept of an adjacency matrix representation of a graph involves using a n x n matrix for a graph G of n vertices.
Algorithmic Complexity
Big-O
Node/Edge Management | Storage | Add Vertex | Add Edge | Remove Vertex | Remove Edge | Query |
---|---|---|---|---|---|---|
Adjacency Matrix | O(|V|^2) | O(|V|^2) | O(1) | O(|V|^2) | O(1) | O(1) |
Implementation
Java Implementation
Coming soon!
References
Wikipedia: Adjacency matrix