def largest_connected_component(matrix):
try:<EOL><INDENT>import scipy.sparse<EOL>n, components = scipy.sparse.csgraph.connected_components(<EOL>matrix, directed=False)<EOL>print("<STR_LIT>" + str(n) + "<STR_LIT>")<EOL>component_dist = collections.Counter(components)<EOL>print("<STR_LIT>" + str(component_dist))<EOL>most_common, _ = component_dist.most_common(<NUM_LIT:1>)[<NUM_LIT:0>]<EOL>ilcc = (components == most_common)<EOL>return matrix[:, ilcc][ilcc]<EOL><DEDENT>except ImportError as e:<EOL><INDENT>print("<STR_LIT>")<EOL>print(str(e))<EOL>print("<STR_LIT>")<EOL>return matrix<EOL><DEDENT>
Compute the adjacency matrix of the largest connected component of the
    graph whose input matrix is adjacent.