Add graph representation using adjacency matrix
- Refactor test code