<qiyuangong>547_Friend_Circles_1.py
def findCircleNum( M):
    visited = [0] * len(M)
    count = 0
    queue = []
    for i in range(len(M)):
        if visited[i] == 0:
            queue.append(i)
            while queue:
                curr = queue.pop(0)
                visited[curr] = 1
                for j in range(len(M)):
                    if M[curr][j] == 1 and visited[j] == 0:
                        queue.append(j)
            count += 1
    return count
def sample_funcname ( var_0 ) :
    var_3 = [ 0 ] * len ( var_0 )
    var_4 = 0
    var_5 = [ ]
    for var_7 in range ( len ( var_0 ) ) :
        if var_3 [ var_7 ] == 0 :
            var_5.append ( var_7 )
            while var_5 :
                var_10 = var_5.pop ( 0 )
                var_3 [ var_10 ] = 1
                for var_12 in range ( len ( var_0 ) ) :
                    if var_0 [ var_10 ] [ var_12 ] == 1 and var_3 [ var_12 ] == 0 :
                        var_5.append ( var_12 )
            var_4 += 1
    return var_4
