

'''simple docstring'''



def       snake_case   (	snake_case      : Union[str, Any]					,		snake_case      : List[Any]			) ->  str:


    """simple docstring"""


    print('\nThe shortest path matrix using Floyd Warshall algorithm\n'			)
    for i in range(snake_case			):
        for j in range(snake_case			):
            if dist[i][j] != float('inf'			):
                print(int(dist[i][j]			)					,		end='\t'			)
            else:
                print('INF'					,		end='\t'			)
        print()


def       snake_case   (	snake_case      : str					,		snake_case      : Optional[int]			) ->  int:


    """simple docstring"""


    lowerCAmelCase 						=							[[float('inf'			) for _ in range(snake_case			)] for _ in range(snake_case			)]

    for i in range(snake_case			):
        for j in range(snake_case			):
            lowerCAmelCase 						=							graph[i][j]

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

    _print_dist(snake_case					,		snake_case			)
    return dist, v


if __name__ == "__main__":
     _UpperCamelCase						:  List[Any]							       =				int(input("Enter number of vertices: "))
     _UpperCamelCase						:  Any							       =				int(input("Enter number of edges: "))

     _UpperCamelCase						:  str							       =				[[float("inf") for i in range(v)] for j in range(v)]

     for i in range(v):
          _UpperCamelCase						:  Optional[Any]							       =				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)
          _UpperCamelCase						:  int							       =				int(input("Enter source:"))
          _UpperCamelCase						:  Any							       =				int(input("Enter destination:"))
          _UpperCamelCase						:  List[Any]							       =				float(input("Enter weight:"))
          _UpperCamelCase						:  Optional[Any]							       =				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 itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast



@dataclass
class 				_snake_case					(   datasets.BuilderConfig			):
  SCREAMING_SNAKE_CASE			:       Optional[datasets.Features]				=     None



class 				_snake_case					(   datasets.ArrowBasedBuilder			):
  SCREAMING_SNAKE_CASE			:       Tuple				=     PandasConfig

  def   _SCREAMING_SNAKE_CASE				(				self	):





      '''simple docstring'''

      return datasets.DatasetInfo(features=self.config.features	)

  def   _SCREAMING_SNAKE_CASE				(				self      , _SCREAMING_SNAKE_CASE	):





      '''simple docstring'''

      if not self.config.data_files:
          raise ValueError(F'At least one data file must be specified, but got data_files={self.config.data_files}'	)
      lowerCAmelCase 						=							dl_manager.download_and_extract(self.config.data_files	)
      if isinstance(_SCREAMING_SNAKE_CASE      , (str, list, tuple)	):
          lowerCAmelCase 						=							data_files
          if isinstance(_SCREAMING_SNAKE_CASE      , _SCREAMING_SNAKE_CASE	):
              lowerCAmelCase 						=							[files]
          # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
          lowerCAmelCase 						=							[dl_manager.iter_files(_SCREAMING_SNAKE_CASE	) for file in files]
          return [datasets.SplitGenerator(name=datasets.Split.TRAIN      , gen_kwargs={'files': files}	)]
      lowerCAmelCase 						=							[]
      for split_name, files in data_files.items():
          if isinstance(_SCREAMING_SNAKE_CASE      , _SCREAMING_SNAKE_CASE	):
              lowerCAmelCase 						=							[files]
          # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
          lowerCAmelCase 						=							[dl_manager.iter_files(_SCREAMING_SNAKE_CASE	) for file in files]
          splits.append(datasets.SplitGenerator(name=_SCREAMING_SNAKE_CASE      , gen_kwargs={'files': files}	)	)
      return splits

  def   _SCREAMING_SNAKE_CASE				(				self      , _SCREAMING_SNAKE_CASE	):





      '''simple docstring'''

      if self.config.features is not None:
          # more expensive cast to support nested features with keys in a different order
          # allows str <-> int/float or str to Audio for example
          lowerCAmelCase 						=							table_cast(_SCREAMING_SNAKE_CASE      , self.config.features.arrow_schema	)
      return pa_table


  def   _SCREAMING_SNAKE_CASE				(				self      , _SCREAMING_SNAKE_CASE	):





      '''simple docstring'''

      for i, file in enumerate(itertools.chain.from_iterable(_SCREAMING_SNAKE_CASE	)	):
          with open(_SCREAMING_SNAKE_CASE      , 'rb'	) as f:
              lowerCAmelCase 						=							pa.Table.from_pandas(pd.read_pickle(_SCREAMING_SNAKE_CASE	)	)
              yield i, self._cast_table(_SCREAMING_SNAKE_CASE	)





