code: def build_nodes(width, height, matrix=None, inverse=False):
      
      nodes = []
      use_matrix = (isinstance(matrix, (tuple, list))) or \
          (USE_NUMPY and isinstance(matrix, np.ndarray) and matrix.size > 0)
  
      for y in range(height):
          nodes.append([])
          for x in range(width):
              # 1, '1', True will be walkable
              # while others will be obstacles
              # if inverse is False, otherwise
              # it changes
              weight = int(matrix[y][x]) if use_matrix else 1
              walkable = weight <= 0 if inverse else weight >= 1
  
              nodes[y].append(Node(x=x, y=y, walkable=walkable, weight=weight))
      return nodes
docs: create nodes according to grid size. If a matrix is given it
      will be used to determine what nodes are walkable.
      :rtype : list