Are there any cases when adjacency matrix should have entries other than 0 and 1?
Yes, because the
(i,j)th entry simply talks about whether or not there exists an edge from vertex
i to vertex
j, and represents existence by a
1 and non-existence by a
However, many graph representations store the edge weight instead of
1s in the matrix. This way, a single matrix can compactly represent both the edges and their weights.