Implement output as adjacency matrix