Added ability to choose form of adjacency matrix.