



'''simple docstring'''





from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass


@dataclass
class 				snake_case :
       lowerCAmelCase__  :int
       lowerCAmelCase__  :int





class 				snake_case :



       def __init__(				self     ,UpperCAmelCase_      )  ->							Union[str, Any]:
           lowercase__		       =						[[] for _ in range(UpperCAmelCase_      )]
           lowercase__		       =						size



       def __getitem__(				self     ,UpperCAmelCase_      )  ->							Iterator[Edge]:
           return iter(self._graph[vertex]      )



       @property
       def 							_a      (				self      )  ->							int:
           return self._size



       def 							_a      (				self     ,UpperCAmelCase_     ,UpperCAmelCase_     ,UpperCAmelCase_      )  ->							Optional[Any]:
           if weight not in (0, 1):
               raise ValueError("Edge weight must be either 0 or 1."      )

           if to_vertex < 0 or to_vertex >= self.size:
               raise ValueError("Vertex indexes must be in [0; size)."      )

           self._graph[from_vertex].append(Edge(UpperCAmelCase_     ,UpperCAmelCase_      )      )







       def 							_a      (				self     ,UpperCAmelCase_     ,UpperCAmelCase_      )  ->							int | None:
           lowercase__		       =						deque([start_vertex]      )
           lowercase__		       =						[None] * self.size
           lowercase__		       =						0

           while queue:
               lowercase__		       =						queue.popleft()
               lowercase__		       =						distances[current_vertex]
               if current_distance is None:
                   continue

               for edge in self[current_vertex]:
                   lowercase__		       =						current_distance + edge.weight
                   lowercase__		       =						distances[edge.destination_vertex]
                   if (
                       isinstance(UpperCAmelCase_     ,UpperCAmelCase_      )
                       and new_distance >= dest_vertex_distance
                   ):
                       continue
                   lowercase__		       =						new_distance
                   if edge.weight == 0:
                       queue.appendleft(edge.destination_vertex      )
                   else:
                       queue.append(edge.destination_vertex      )

           if distances[finish_vertex] is None:
               raise ValueError("No path from start_vertex to finish_vertex."      )

           return distances[finish_vertex]


if __name__ == "__main__":
 import doctest

 doctest.testmod()









'''simple docstring'''





def        lowerCamelCase  (				_snake_case  :						int     ,_snake_case  :						float     ,_snake_case  :						float       ):





    '''simple docstring'''


    return round(float(moles / volume       ) * nfactor       )




def        lowerCamelCase  (				_snake_case  :						float     ,_snake_case  :						float     ,_snake_case  :						float       ):





    '''simple docstring'''


    return round(float((moles * 0.0_821 * temperature) / (volume)       )       )




def        lowerCamelCase  (				_snake_case  :						float     ,_snake_case  :						float     ,_snake_case  :						float       ):





    '''simple docstring'''


    return round(float((moles * 0.0_821 * temperature) / (pressure)       )       )




def        lowerCamelCase  (				_snake_case  :						float     ,_snake_case  :						float     ,_snake_case  :						float       ):





    '''simple docstring'''


    return round(float((pressure * volume) / (0.0_821 * moles)       )       )


if __name__ == "__main__":
 import doctest

 doctest.testmod()




