
'''simple docstring'''
from __future__ import annotations






class      snake_case__    :







		"""simple docstring"""

		def __init__(	self							:       List[Any]   ,     UpperCamelCase__							:       int	)		->       None:






				"""simple docstring"""







				snake_case   :    Dict			       =		vertices
				snake_case   :    Dict			       =		[[0] * vertices for _ in range(UpperCamelCase__	)]



		def 	lowerCAmelCase							(	self							:       Dict   ,     UpperCamelCase__							:       list[int]	)		->       None:






				"""simple docstring"""







				print('''Vertex \t Distance from Source'''	)
				for vertex in range(self.vertices	):
						print(UpperCamelCase__   ,     '''\t\t'''   ,     distances_from_source[vertex]	)



		def 	lowerCAmelCase							(	self							:       str   ,     UpperCamelCase__							:       list[int]   ,     UpperCamelCase__							:       list[bool]	)		->       int:






				"""simple docstring"""







				snake_case   :    str			       =		1e7
				snake_case   :    List[str]			       =		0

				# Search not nearest vertex not in the shortest path tree
				for vertex in range(self.vertices	):
						if distances_from_source[vertex] < minimum and visited[vertex] is False:
								snake_case   :    Union[str, Any]			       =		distances_from_source[vertex]
								snake_case   :    int			       =		vertex
				return min_index



		def 	lowerCAmelCase							(	self							:       List[Any]   ,     UpperCamelCase__							:       int	)		->       None:






				"""simple docstring"""







				snake_case   :    List[str]			       =		[int(1e7	)] * self.vertices  # distances from the source
				snake_case   :    Optional[Any]			       =		0
				snake_case   :    List[Any]			       =		[False] * self.vertices

				for _ in range(self.vertices	):
						snake_case   :    Optional[int]			       =		self.minimum_distance(UpperCamelCase__   ,     UpperCamelCase__	)
						snake_case   :    List[Any]			       =		True

						# Update dist value of the adjacent vertices
						# of the picked vertex only if the current
						# distance is greater than new distance and
						# the vertex in not in the shortest path tree
						for v in range(self.vertices	):
								if (
								    self.graph[u][v] > 0
								    and visited[v] is False
								    and distances[v] > distances[u] + self.graph[u][v]
								):
										snake_case   :    int			       =		distances[u] + self.graph[u][v]

				self.print_solution(UpperCamelCase__	)


if __name__ == "__main__":
						lowercase__		    =	Graph(9)
						lowercase__		    =	[
						    [0, 4, 0, 0, 0, 0, 0, 8, 0],
						    [4, 0, 8, 0, 0, 0, 0, 1_1, 0],
						    [0, 8, 0, 7, 0, 4, 0, 0, 2],
						    [0, 0, 7, 0, 9, 1_4, 0, 0, 0],
						    [0, 0, 0, 9, 0, 1_0, 0, 0, 0],
						    [0, 0, 4, 1_4, 1_0, 0, 2, 0, 0],
						    [0, 0, 0, 0, 0, 2, 0, 1, 6],
						    [8, 1_1, 0, 0, 0, 0, 1, 0, 7],
						    [0, 0, 2, 0, 0, 0, 6, 7, 0],
						]
						graph.dijkstra(0)




'''simple docstring'''
from __future__ import annotations

from collections.abc import Callable




def 					_UpperCamelCase		(    SCREAMING_SNAKE_CASE__      ,    SCREAMING_SNAKE_CASE__      ,    SCREAMING_SNAKE_CASE__      ,    SCREAMING_SNAKE_CASE__ = 100      ,    )   ->				float:


		'''simple docstring'''


		snake_case   :    int			       =		x_start
		snake_case   :    Tuple			       =		fnc(SCREAMING_SNAKE_CASE__       )
		snake_case   :    Dict			       =		0.0

		for _ in range(SCREAMING_SNAKE_CASE__       ):
				# Approximates small segments of curve as linear and solve
				# for trapezoidal area
				snake_case   :    str			       =		(x_end - x_start) / steps + xa
				snake_case   :    str			       =		fnc(SCREAMING_SNAKE_CASE__       )
				area += abs(fxa + fxa       ) * (xa - xa) / 2

				# Increment step
				snake_case   :    Any			       =		xa
				snake_case   :    List[str]			       =		fxa
		return area


if __name__ == "__main__":




						def 					_UpperCamelCase		(    SCREAMING_SNAKE_CASE__       )   ->				str:


								'''simple docstring'''


								return x**3

						print("f(x) = x^3")
						print("The area between the curve, x = -10, x = 10 and the x axis is:")
						lowercase__		    =	1_0
						while i <= 1_0_0_0_0_0:
												lowercase__		    =	trapezoidal_area(f, -5, 5, i)
												print(f"with {i} steps: {area}")
												i *= 1_0


