Given: an undirected graph.
How many edges must you remove to make it a tree? (Or a forest of trees?)
Input Specification
An adjacency matrix, 0
or 1
).
The matrix will be symmetrical (it is undirected!).
Output Specification
The minimum number of edges you have to remove.
Sample Input
Copy
3
0 1 1
1 0 1
1 1 0
Sample Output
Copy
1
Comments