code: def network_simplex_core(
      node_arc_data, spanning_tree, graph, max_iter
  ):
      # pivot_block = PivotBlock(
      #     max(np.int32(np.sqrt(graph.n_arcs)), 10),
      #     np.zeros(1, dtype=np.int32),
      #     graph.n_arcs,
      # )
      pivot_block_size = max(np.int32(np.sqrt(graph.n_arcs)), 10)
      search_arc_num = graph.n_arcs
      solution_status = ProblemStatus.OPTIMAL
  
      # Perform heuristic initial pivots
      bounded, in_arc = construct_initial_pivots(
          graph, node_arc_data, spanning_tree
      )
      if not bounded:
          return ProblemStatus.UNBOUNDED
  
      iter_number = 0
      # pivot.setDantzig(true);
      # Execute the Network Simplex algorithm
      in_arc, pivot_next_arc = find_entering_arc(
          pivot_block_size,
          0,
          search_arc_num,
          spanning_tree.state,
          node_arc_data,
          in_arc,
      )
      while in_arc >= 0:
          iter_number += 1
          if max_iter > 0 and iter_number >= max_iter:
              solution_status = ProblemStatus.MAX_ITER_REACHED
              break
  
          join = find_join_node(
              node_arc_data.source,
              node_arc_data.target,
              spanning_tree.succ_num,
              spanning_tree.parent,
              in_arc,
          )
          leaving_arc_data = find_leaving_arc(
              join, in_arc, node_arc_data, spanning_tree
          )
          if leaving_arc_data.delta >= MAX:
              return ProblemStatus.UNBOUNDED
  
          update_flow(
              join,
              leaving_arc_data,
              node_arc_data,
              spanning_tree,
              in_arc,
          )
  
          if leaving_arc_data.change:
              update_spanning_tree(
                  spanning_tree,
                  leaving_arc_data,
                  join,
                  in_arc,
                  node_arc_data.source,
              )
              update_potential(
                  leaving_arc_data,
                  node_arc_data.pi,
                  node_arc_data.cost,
                  spanning_tree,
              )
  
          in_arc, pivot_next_arc = find_entering_arc(
              pivot_block_size,
              pivot_next_arc,
              search_arc_num,
              spanning_tree.state,
              node_arc_data,
              in_arc,
          )
  
      flow = node_arc_data.flow
      pi = node_arc_data.pi
  
      # Check feasibility
      if solution_status == ProblemStatus.OPTIMAL:
          for e in range(graph.n_arcs, graph.n_arcs + graph.n_nodes):
              if flow[e] != 0:
                  if np.abs(flow[e]) > EPSILON:
                      return ProblemStatus.INFEASIBLE
                  else:
                      flow[e] = 0
  
      # Shift potentials to meet the requirements of the GEQ/LEQ type
      # optimality conditions
      max_pot = -INFINITY
      for i in range(graph.n_nodes):
          if pi[i] > max_pot:
              max_pot = pi[i]
      if max_pot > 0:
          for i in range(graph.n_nodes):
              pi[i] -= max_pot
  
      return solution_status
  
imports: import numpy
  import numba
  from collections import namedtuple
  from enum import Enum, IntEnum
label_desc: Use image node_id 16 for calling a global function with example usage: network_simplex_core(node_arc_data, spanning_tree, graph, max_iter) and returns: solution_status, ProblemStatus, ProblemStatus, ProblemStatus