adjacency matrix class and exceptions added