code: def gen_pyramid(N):
      # This graph admits a flow of value 1 for which every arc is at
      # capacity (except the arcs incident to the sink which have
      # infinite capacity).
      G = nx.DiGraph()
  
      for i in range(N - 1):
          cap = 1.0 / (i + 2)
          for j in range(i + 1):
              G.add_edge((i, j), (i + 1, j), capacity=cap)
              cap = 1.0 / (i + 1) - cap
              G.add_edge((i, j), (i + 1, j + 1), capacity=cap)
              cap = 1.0 / (i + 2) - cap
  
      for j in range(N):
          G.add_edge((N - 1, j), "t")
  
      return G
  
file_path: networkx/networkx/algorithms/flow/tests/test_maxflow_large_graph.py
imports: import bz2
  import importlib.resources
  import os
  import pickle
  import pytest
  import networkx
  from networkx.algorithms.flow import boykov_kolmogorov, build_flow_dict, build_residual_network, dinitz, edmonds_karp, preflow_push, shortest_augmenting_path
label_desc: Use image node_id 1 for calling a global function with example usage: gen_pyramid(N) and returns: G