code: def detect_unboundedness(R, s, t):
      """Detect an infinite-capacity s-t path in R."""
      q = deque([s])
      seen = {s}
      inf = R.graph["inf"]
      while q:
          u = q.popleft()
          for v, attr in R[u].items():
              if attr["capacity"] == inf and v not in seen:
                  if v == t:
                      raise nx.NetworkXUnbounded(
                          "Infinite capacity path, flow unbounded above."
                      )
                  seen.add(v)
                  q.append(v)
  
file_path: networkx/networkx/algorithms/flow/utils.py
imports: from collections import deque
  import networkx
label_desc: Use image node_id 2 for calling a global function with example usage: detect_unboundedness(R, s, t) without return types