





'''simple docstring'''


def 							UpperCAmelCase_  (						__lowerCamelCase : Union[str, Any]     ,__lowerCamelCase : List[Any]			):
   print("\nThe shortest path matrix using Floyd Warshall algorithm\n"			)
   for i in range(__lowerCamelCase			):
      for j in range(__lowerCamelCase			):
         if dist[i][j] != float("inf"			):
            print(int(dist[i][j]			)     ,end="\t"			)
         else:
            print("INF"     ,end="\t"			)
      print()
def 							UpperCAmelCase_  (						__lowerCamelCase : Optional[int]     ,__lowerCamelCase : List[Any]			):
   lowercase_      :int         =			[[float("inf"			) for _ in range(__lowerCamelCase			)] for _ in range(__lowerCamelCase			)]

   for i in range(__lowerCamelCase			):
      for j in range(__lowerCamelCase			):
         lowercase_      :Tuple         =			graph[i][j]

         # check vertex k against all other vertices (i, j)
   for k in range(__lowerCamelCase			):
      # looping through rows of graph array
      for i in range(__lowerCamelCase			):
         # looping through columns of graph array
         for j in range(__lowerCamelCase			):
            if (
                dist[i][k] != float("inf"			)
                and dist[k][j] != float("inf"			)
                and dist[i][k] + dist[k][j] < dist[i][j]
            ):
               lowercase_      :Optional[Any]         =			dist[i][k] + dist[k][j]

   _print_dist(__lowerCamelCase     ,__lowerCamelCase			)
   return dist, v


if __name__ == "__main__":
 lowerCAmelCase :					Tuple 							=int(input('''Enter number of vertices: '''))
 lowerCAmelCase :					Tuple 							=int(input('''Enter number of edges: '''))

 lowerCAmelCase :					Union[str, Any] 							=[[float('''inf''') for i in range(v)] for j in range(v)]

 for i in range(v):
  lowerCAmelCase :					str 							=0.0

  # src and dst are indices that must be within the array size graph[e][v]
  # failure to follow this will result in an error
 for i in range(e):
  print('''\nEdge ''', i + 1)
  lowerCAmelCase :					List[Any] 							=int(input('''Enter source:'''))
  lowerCAmelCase :					str 							=int(input('''Enter destination:'''))
  lowerCAmelCase :					Optional[int] 							=float(input('''Enter weight:'''))
  lowerCAmelCase :					List[str] 							=weight

 floyd_warshall(graph, v)

 # Example Input
 # Enter number of vertices: 3
 # Enter number of edges: 2

 # # generated graph from vertex and edge inputs
 # [[inf, inf, inf], [inf, inf, inf], [inf, inf, inf]]
 # [[0.0, inf, inf], [inf, 0.0, inf], [inf, inf, 0.0]]

 # specify source, destination and weight for edge #1
 # Edge  1
 # Enter source:1
 # Enter destination:2
 # Enter weight:2

 # specify source, destination and weight for edge #2
 # Edge  2
 # Enter source:2
 # Enter destination:1
 # Enter weight:1

 # # Expected Output from the vertice, edge and src, dst, weight inputs!!
 # 0		INF	INF
 # INF	0	2
 # INF	1	0









'''simple docstring'''


import numpy as np
def 							UpperCAmelCase_  (						__lowerCamelCase : str     ,__lowerCamelCase : Optional[Any]     ,__lowerCamelCase : int     ,__lowerCamelCase : List[str]     ,__lowerCamelCase : List[Any]			):
   lowercase_      :Dict         =			int(np.ceil((x_end - xa) / h			)			)
   lowercase_      :Optional[int]         =			np.zeros((n + 1,)			)
   lowercase_      :Tuple         =			ya
   lowercase_      :List[str]         =			xa

   for k in range(__lowerCamelCase			):
      lowercase_      :Any         =			f(__lowerCamelCase     ,y[k]			)
      lowercase_      :Optional[Any]         =			f(x + 0.5 * h     ,y[k] + 0.5 * h * ka			)
      lowercase_      :Optional[Any]         =			f(x + 0.5 * h     ,y[k] + 0.5 * h * ka			)
      lowercase_      :Any         =			f(x + h     ,y[k] + h * ka			)
      lowercase_      :Tuple         =			y[k] + (1 / 6) * h * (ka + 2 * ka + 2 * ka + ka)
      x += h

   return y


if __name__ == "__main__":
 import doctest

 doctest.testmod()


