code: def test_all_pairs_shortest_path(self):
      p = dict(nx.shortest_path(self.cycle))
      assert p[0][3] == [0, 1, 2, 3]
      assert p == dict(nx.all_pairs_shortest_path(self.cycle))
      p = dict(nx.shortest_path(self.grid))
      validate_grid_path(4, 4, 1, 12, p[1][12])
      # now with weights
      p = dict(nx.shortest_path(self.cycle, weight="weight"))
      assert p[0][3] == [0, 1, 2, 3]
      assert p == dict(nx.all_pairs_dijkstra_path(self.cycle))
      p = dict(nx.shortest_path(self.grid, weight="weight"))
      validate_grid_path(4, 4, 1, 12, p[1][12])
      # weights and method specified
      p = dict(
          nx.shortest_path(
              self.cycle, weight="weight", method="dijkstra"
          )
      )
      assert p[0][3] == [0, 1, 2, 3]
      assert p == dict(nx.all_pairs_dijkstra_path(self.cycle))
      p = dict(
          nx.shortest_path(
              self.cycle, weight="weight", method="bellman-ford"
          )
      )
      assert p[0][3] == [0, 1, 2, 3]
      assert p == dict(nx.all_pairs_bellman_ford_path(self.cycle))
  
imports: import pytest
  import networkx
label_desc: Use image node_id 9 for calling the TestGenericPath obj's underlying member method code with example usage: obj.test_all_pairs_shortest_path() without return types