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