added adjacency matrix functionality