





_lowerCamelCase   				=			{
    'A': ['B', 'C', 'E'],
    'B': ['A', 'D', 'E'],
    'C': ['A', 'F', 'G'],
    'D': ['B'],
    'E': ['A', 'B', 'D'],
    'F': ['C'],
    'G': ['C'],
}






def 				SCREAMING_SNAKE_CASE__							(       UpperCamelCase__:							dict					,   UpperCamelCase__:							Dict					,   UpperCamelCase__:							Dict    ):
		SCREAMING_SNAKE_CASE__			=      set()
		# keep track of all the paths to be checked
		SCREAMING_SNAKE_CASE__			=      [[start]]

		# return path if start is goal
		if start == goal:
				return [start]

		# keeps looping until all possible paths have been checked
		while queue:
				# pop the first path from the queue
				SCREAMING_SNAKE_CASE__			=      queue.pop(0    )
				# get the last node from the path
				SCREAMING_SNAKE_CASE__			=      path[-1]
				if node not in explored:
						SCREAMING_SNAKE_CASE__			=      graph[node]
						# go through all neighbour nodes, construct a new path and
						# push it into the queue
						for neighbour in neighbours:
								SCREAMING_SNAKE_CASE__			=      list(UpperCamelCase__    )
								new_path.append(UpperCamelCase__    )
								queue.append(UpperCamelCase__    )
								# return path if neighbour is goal
								if neighbour == goal:
										return new_path

            # mark node as explored
						explored.add(UpperCamelCase__    )

    # in case there's no path between the 2 nodes
		return []






def 				SCREAMING_SNAKE_CASE__							(       UpperCamelCase__:							dict					,   UpperCamelCase__:							List[Any]					,   UpperCamelCase__:							Any    ):
		if not graph or start not in graph or target not in graph:
				return -1
		if start == target:
				return 0
		SCREAMING_SNAKE_CASE__			=      [start]
		SCREAMING_SNAKE_CASE__			=      set(UpperCamelCase__    )
		# Keep tab on distances from `start` node.
		SCREAMING_SNAKE_CASE__			=      {start: 0, target: -1}
		while queue:
				SCREAMING_SNAKE_CASE__			=      queue.pop(0    )
				if node == target:
						SCREAMING_SNAKE_CASE__			=      (
						    dist[node] if dist[target] == -1 else min(dist[target]					,   dist[node]    )
						)
				for adjacent in graph[node]:
						if adjacent not in visited:
								visited.add(UpperCamelCase__    )
								queue.append(UpperCamelCase__    )
								SCREAMING_SNAKE_CASE__			=      dist[node] + 1
		return dist[target]


if __name__ == "__main__":
	print(bfs_shortest_path(demo_graph, 'G', 'D'))  # returns ['G', 'C', 'A', 'B', 'D']
	print(bfs_shortest_path_distance(demo_graph, 'G', 'D'))  # returns 4






import unittest

from datasets import load_dataset

from transformers.pipelines import pipeline
from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow




@is_pipeline_test
@require_torch
class   UpperCamelCase_       (     unittest.TestCase    ):


							@require_torch
							def      _snake_case  (							self    :Dict		)   ->   Optional[Any]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__			=      pipeline(
									    task="""zero-shot-audio-classification"""							,				model="""hf-internal-testing/tiny-clap-htsat-unfused"""		)
									SCREAMING_SNAKE_CASE__			=      load_dataset("""ashraq/esc50"""		)
									SCREAMING_SNAKE_CASE__			=      dataset["""train"""]["""audio"""][-1]["""array"""]
									SCREAMING_SNAKE_CASE__			=      audio_classifier(__A							,				candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]		)
									self.assertEqual(
									    nested_simplify(__A		)							,				[{"""score""": 0.5_0_1, """label""": """Sound of a dog"""}, {"""score""": 0.4_9_9, """label""": """Sound of vaccum cleaner"""}]							,				)


							@unittest.skip("""No models are available in TF"""		)
							def      _snake_case  (							self    :Dict		)   ->   List[str]:



									"""simple docstring"""



									pass


							@slow
							@require_torch
							def      _snake_case  (							self    :Any		)   ->   int:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__			=      pipeline(
									    task="""zero-shot-audio-classification"""							,				model="""laion/clap-htsat-unfused"""							,				)
									# This is an audio of a dog
									SCREAMING_SNAKE_CASE__			=      load_dataset("""ashraq/esc50"""		)
									SCREAMING_SNAKE_CASE__			=      dataset["""train"""]["""audio"""][-1]["""array"""]
									SCREAMING_SNAKE_CASE__			=      audio_classifier(__A							,				candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]		)

									self.assertEqual(
									    nested_simplify(__A		)							,				[
									        {"""score""": 0.9_9_9, """label""": """Sound of a dog"""},
									        {"""score""": 0.0_0_1, """label""": """Sound of vaccum cleaner"""},
									    ]							,				)

									SCREAMING_SNAKE_CASE__			=      audio_classifier([audio] * 5							,				candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]		)
									self.assertEqual(
									    nested_simplify(__A		)							,				[
									        [
									            {"""score""": 0.9_9_9, """label""": """Sound of a dog"""},
									            {"""score""": 0.0_0_1, """label""": """Sound of vaccum cleaner"""},
									        ],
									    ]
									    * 5							,				)
									SCREAMING_SNAKE_CASE__			=      audio_classifier(
									    [audio] * 5							,				candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]							,				batch_size=5		)
									self.assertEqual(
									    nested_simplify(__A		)							,				[
									        [
									            {"""score""": 0.9_9_9, """label""": """Sound of a dog"""},
									            {"""score""": 0.0_0_1, """label""": """Sound of vaccum cleaner"""},
									        ],
									    ]
									    * 5							,				)


							@unittest.skip("""No models are available in TF"""		)
							def      _snake_case  (							self    :str		)   ->   Optional[int]:



									"""simple docstring"""



									pass