Add implementations of adjacent matrix
 and exception for matrix malformation