180k views
4 votes
How can you tell if a graph is a tree by looking at the adjacency to matrix

1 Answer

5 votes

Let's assume that a tree has N nodes, this means that this tree has N-1 edges.

For an adjacency matrix representing a tree, such will have 2(N-1) 1's, since each edge sets two bits in the matrix (with no 1's on the diagonal, since trees have no self-edges).

User Ruba
by
5.0k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.