# Are all adjacency matrices represented by 0 and 1s? [closed]

Are there any cases when adjacency matrix should have entries other than 0 and 1?

## closed as unclear what you're asking by David Richerby, R B, Juho, D.W.♦, Luke MathiesonDec 22 '14 at 23:46

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• This could have been answered just by looking at Wikipedia: for example, the section "variations" gives the example of $(a,b,c)$-adjacency matrices. You are expected to do some basic research before asking questions here. – David Richerby Dec 17 '14 at 9:00

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 0.
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.
• Note that, if you want to have an edge whose weight is zero, you can't use a single matrix to represent both the adjacencies and the weight. (Unless you represent non-edges by $-\infty$, but then you can't represent edges with weight $-\infty$ and so on.) – David Richerby Dec 17 '14 at 9:01