Represent the graph with an adjacency matrix