class_docstr: A graph consists of connected Blocks, or Heads.
  
  # Arguments
      inputs: A list of input node(s) for the Graph.
      outputs: A list of output node(s) for the Graph.
code: def _build_network(self):
      self._node_to_id = {}
  
      # Recursively find all the interested nodes.
      for input_node in self.inputs:
          self._search_network(input_node, self.outputs, set(), set())
      self._nodes = sorted(
          list(self._node_to_id.keys()),
          key=lambda x: self._node_to_id[x],
      )
  
      for node in self.inputs + self.outputs:
          if node not in self._node_to_id:
              raise ValueError("Inputs and outputs not connected.")
  
      # Find the blocks.
      blocks = []
      for input_node in self._nodes:
          for block in input_node.out_blocks:
              if (
                  any(
                      [
                          output_node in self._node_to_id
                          for output_node in block.outputs
                      ]
                  )
                  and block not in blocks
              ):
                  blocks.append(block)
  
      # Check if all the inputs of the blocks are set as inputs.
      for block in blocks:
          for input_node in block.inputs:
              if input_node not in self._node_to_id:
                  raise ValueError(
                      "A required input is missing for HyperModel "
                      "{name}.".format(name=block.name)
                  )
  
      # Calculate the in degree of all the nodes
      in_degree = [0] * len(self._nodes)
      for node_id, node in enumerate(self._nodes):
          in_degree[node_id] = len(
              [block for block in node.in_blocks if block in blocks]
          )
  
      # Add the blocks in topological order.
      self.blocks = []
      self._block_to_id = {}
      while len(blocks) != 0:
          new_added = []
  
          # Collect blocks with in degree 0.
          for block in blocks:
              if any(
                  [
                      in_degree[self._node_to_id[node]]
                      for node in block.inputs
                  ]
              ):
                  continue
              new_added.append(block)
  
          # Remove the collected blocks from blocks.
          for block in new_added:
              blocks.remove(block)
  
          for block in new_added:
              # Add the collected blocks to the Graph.
              self._add_block(block)
  
              # Decrease the in degree of the output nodes.
              for output_node in block.outputs:
                  output_node_id = self._node_to_id[output_node]
                  in_degree[output_node_id] -= 1
  
imports: import keras_tuner
  from tensorflow import keras
  from tensorflow import nest
  from autokeras import blocks
  from autokeras import keras_layers
  from autokeras import nodes
  from autokeras.engine import head
  from autokeras.engine import serializable
  from autokeras.utils import io_utils
label_desc: Use image node_id 3 for calling the Graph obj's underlying member method code with example usage: obj._build_network() without return types