def _graph_is_connected(graph):
if sparse.isspmatrix(graph):<EOL><INDENT>n_connected_components, _ = connected_components(graph)<EOL>return n_connected_components == <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>return _graph_connected_component(graph, <NUM_LIT:0>).sum() == graph.shape[<NUM_LIT:0>]<EOL><DEDENT>
Return whether the graph is connected (True) or Not (False)

Parameters
----------
graph : array-like or sparse matrix, shape: (n_samples, n_samples)
    adjacency matrix of the graph, non-zero weight means an edge
    between the nodes

Returns
-------
is_connected : bool
    True means the graph is fully connected and False means not