




'''simple docstring'''







from __future__ import annotations

from queue import Queue


class      _a    :
       def __init__(      self		:      Union[str, Any]							):



           '''simple docstring'''

           UpperCAmelCase     			=						{}
       def        A (      self		:      Dict							):



           '''simple docstring'''

           for i in self.vertices:
               print(lowercase  ,							''' : '''  ,							''' -> '''.join([str(lowercase							) for j in self.vertices[i]]							)							)
       def        A (      self		:      Optional[Any]  ,							lowercase		:      int  ,							lowercase		:      int							):



           '''simple docstring'''

           if from_vertex in self.vertices:
               self.vertices[from_vertex].append(lowercase							)
           else:
               UpperCAmelCase     			=						[to_vertex]







       def        A (      self		:      List[Any]  ,							lowercase		:      int							):



           '''simple docstring'''

           UpperCAmelCase     			=						set()

           # create a first in first out queue to store all the vertices for BFS
           UpperCAmelCase     			=						Queue()

           # mark the source node as visited and enqueue it
           visited.add(lowercase							)
           queue.put(lowercase							)

           while not queue.empty():
               UpperCAmelCase     			=						queue.get()

               # loop through all adjacent vertex and enqueue it if not yet visited
               for adjacent_vertex in self.vertices[vertex]:
                   if adjacent_vertex not in visited:
                       queue.put(lowercase							)
                       visited.add(lowercase							)
           return visited


if __name__ == "__main__":
   from doctest import testmod

   testmod(verbose=True)

   A					       =Graph()
   g.add_edge(0, 1)
   g.add_edge(0, 2)
   g.add_edge(1, 2)
   g.add_edge(2, 0)
   g.add_edge(2, 3)
   g.add_edge(3, 3)

   g.print_graph()
   # 0  :  1 -> 2
   # 1  :  2
   # 2  :  0 -> 3
   # 3  :  3

   assert sorted(g.bfs(2)) == [0, 1, 2, 3]










'''simple docstring'''







def 		snake_case_				(_a      :				Any       ,  _a      :				Union[str, Any]	):
    if n < 0:
        return 0
    # table[i] represents the number of ways to get to amount i
    UpperCAmelCase     			=						[0] * (n + 1)

    # There is exactly 1 way to get to zero(You pick no coins).
    UpperCAmelCase     			=						1

    # Pick all coins one by one and update table[] values
    # after the index greater than or equal to the value of the
    # picked coin
    for coin_val in s:
        for j in range(_a       ,  n + 1	):
            table[j] += table[j - coin_val]

    return table[n]


if __name__ == "__main__":
   import doctest

   doctest.testmod()




