Represent graph using adjacency matrix (#706)