Add edges and update degrees
g [ 1 ] . append ( 2 ) NEW_LINE g [ 2 ] . append ( 1 ) NEW_LINE deg [ 1 ] += 1 NEW_LINE deg [ 2 ] += 1 NEW_LINE g [ 1 ] . append ( 5 ) NEW_LINE g [ 5 ] . append ( 1 ) NEW_LINE deg [ 1 ] += 1 NEW_LINE deg [ 5 ] += 1 NEW_LINE g [ 2 ] . append ( 3 ) NEW_LINE g [ 3 ] . append ( 2 ) NEW_LINE deg [ 2 ] += 1 NEW_LINE deg [ 3 ] += 1 NEW_LINE g [ 5 ] . append ( 3 ) NEW_LINE g [ 3 ] . append ( 5 ) NEW_LINE deg [ 3 ] += 1 NEW_LINE deg [ 5 ] += 1 NEW_LINE g [ 3 ] . append ( 4 ) NEW_LINE g [ 4 ] . append ( 3 ) NEW_LINE deg [ 3 ] += 1 NEW_LINE deg [ 4 ] += 1 NEW_LINE findSpanningTree ( deg , n , m , g ) NEW_LINE