code: def test_negative_cycle(self):
      G = nx.cycle_graph(5, create_using=nx.DiGraph())
      G.add_edge(1, 2, weight=-7)
      for i in range(5):
          pytest.raises(
              nx.NetworkXUnbounded,
              nx.single_source_bellman_ford_path,
              G,
              i,
          )
          pytest.raises(
              nx.NetworkXUnbounded,
              nx.single_source_bellman_ford_path_length,
              G,
              i,
          )
          pytest.raises(
              nx.NetworkXUnbounded, nx.single_source_bellman_ford, G, i
          )
          pytest.raises(
              nx.NetworkXUnbounded,
              nx.bellman_ford_predecessor_and_distance,
              G,
              i,
          )
          pytest.raises(nx.NetworkXUnbounded, nx.goldberg_radzik, G, i)
      G = nx.cycle_graph(5)  # undirected Graph
      G.add_edge(1, 2, weight=-3)
      for i in range(5):
          pytest.raises(
              nx.NetworkXUnbounded,
              nx.single_source_bellman_ford_path,
              G,
              i,
          )
          pytest.raises(
              nx.NetworkXUnbounded,
              nx.single_source_bellman_ford_path_length,
              G,
              i,
          )
          pytest.raises(
              nx.NetworkXUnbounded, nx.single_source_bellman_ford, G, i
          )
          pytest.raises(
              nx.NetworkXUnbounded,
              nx.bellman_ford_predecessor_and_distance,
              G,
              i,
          )
          pytest.raises(nx.NetworkXUnbounded, nx.goldberg_radzik, G, i)
      G = nx.DiGraph([(1, 1, {"weight": -1})])
      pytest.raises(
          nx.NetworkXUnbounded, nx.single_source_bellman_ford_path, G, 1
      )
      pytest.raises(
          nx.NetworkXUnbounded,
          nx.single_source_bellman_ford_path_length,
          G,
          1,
      )
      pytest.raises(
          nx.NetworkXUnbounded, nx.single_source_bellman_ford, G, 1
      )
      pytest.raises(
          nx.NetworkXUnbounded,
          nx.bellman_ford_predecessor_and_distance,
          G,
          1,
      )
      pytest.raises(nx.NetworkXUnbounded, nx.goldberg_radzik, G, 1)
      G = nx.MultiDiGraph([(1, 1, {"weight": -1})])
      pytest.raises(
          nx.NetworkXUnbounded, nx.single_source_bellman_ford_path, G, 1
      )
      pytest.raises(
          nx.NetworkXUnbounded,
          nx.single_source_bellman_ford_path_length,
          G,
          1,
      )
      pytest.raises(
          nx.NetworkXUnbounded, nx.single_source_bellman_ford, G, 1
      )
      pytest.raises(
          nx.NetworkXUnbounded,
          nx.bellman_ford_predecessor_and_distance,
          G,
          1,
      )
      pytest.raises(nx.NetworkXUnbounded, nx.goldberg_radzik, G, 1)
  
imports: import pytest
  import networkx
  from networkx.utils import pairwise
label_desc: Use image node_id 6 for calling the TestBellmanFordAndGoldbergRadzik obj's underlying member method code with example usage: obj.test_negative_cycle() without return types