code: def _graph_connected_component(graph, node_id):
      """Find the largest graph connected components that contains one
      given node.
  
      Arguments
      ---------
      graph : array-like, shape: (n_samples, n_samples)
          Adjacency matrix of the graph, non-zero weight means an edge
          between the nodes.
      node_id : int
          The index of the query node of the graph.
  
      Returns
      -------
      connected_components_matrix : array-like
          shape - (n_samples,).
          An array of bool value indicating the indexes of the nodes belonging
          to the largest connected components of the given query node.
      """
  
      n_node = graph.shape[0]
      if sparse.issparse(graph):
          # speed up row-wise access to boolean connection mask
          graph = graph.tocsr()
      connected_nodes = np.zeros(n_node, dtype=bool)
      nodes_to_explore = np.zeros(n_node, dtype=bool)
      nodes_to_explore[node_id] = True
      for _ in range(n_node):
          last_num_component = connected_nodes.sum()
          np.logical_or(
              connected_nodes, nodes_to_explore, out=connected_nodes
          )
          if last_num_component >= connected_nodes.sum():
              break
          indices = np.where(nodes_to_explore)[0]
          nodes_to_explore.fill(False)
          for i in indices:
              if sparse.issparse(graph):
                  neighbors = graph[i].toarray().ravel()
              else:
                  neighbors = graph[i]
              np.logical_or(
                  nodes_to_explore, neighbors, out=nodes_to_explore
              )
      return connected_nodes
  
imports: import csv
  import numbers
  import warnings
  import scipy
  import pytest
  import numpy
  from scipy import sparse
  from scipy.sparse.linalg import eigsh
  from scipy.sparse.csgraph import connected_components
  from scipy.sparse.csgraph import laplacian
label_desc: Use image node_id 8 for calling a global function with example usage: _graph_connected_component(graph, node_id) and returns: connected_nodes