# Path: py_algorithms/challenges/coderbyte/sp_in_unweigted_graph.py
# class SPUnweightedCyclicGraph:
#     """
#     Have the function f(strArr) take strArr which will be an array of strings which
#     models a non-looping Graph.The structure of the array will be as follows:
#     The first element in the array will be the number of nodes N (points) in the
#     array as a string. The next N elements will be the nodes which can be anything
#     (A, B, C .. Brick Street, Main Street .. etc.). Then after the Nth element,
#     the rest of the elements in the array will be the connections between all of the nodes.
#     They will look like this: (A-B, B-C .. Brick Street-Main Street .. etc.).
#     Although, there may exist no connections at all.
# 
#     Input example: ["4", "A", "B", "C", "D", "A-B", "B-D", "B-C", "C-D"]
#     Expected output: 'A-B-D'
#     """
# 
#     def __call__(self, str_arr: str) -> Union[str, int]:
#         nodes_count = int(str_arr[0])
#         nodes = str_arr[1:nodes_count + 1]
#         connections = [x.split('-') for x in str_arr[nodes_count + 1:]]
# 
#         _from = nodes[0]
#         _to = nodes[len(nodes) - 1]
#         _adj = self._make_adj_list(connections)
# 
#         traversal = Bfs(_adj, _from)
#         path = traversal.path_to(_to)
# 
#         if not path:
#             return -1
#         return '-'.join(path)
# 
#     # Construct adjacency list, so it could be
#     # consumed by DFS algorithm
#     @staticmethod
#     def _make_adj_list(connections):
#         adj_list = {}
#         for pair in connections:
#             # assign an empty list if not exist yet
#             for x in pair:
#                 if not adj_list.get(x, False):
#                     adj_list[x] = []
#             adj_list[pair[0]].append(pair[1])
#             adj_list[pair[1]].append(pair[0])
#         return adj_list


from py_algorithms.challenges.coderbyte.sp_in_unweigted_graph import SPUnweightedCyclicGraph


class TestBinarySearchTreeLca:
    def test_impl(self):
        inputs = {

# Path: py_algorithms/challenges/coderbyte/sp_in_unweigted_graph.py
# class SPUnweightedCyclicGraph:
#     """
#     Have the function f(strArr) take strArr which will be an array of strings which
#     models a non-looping Graph.The structure of the array will be as follows:
#     The first element in the array will be the number of nodes N (points) in the
#     array as a string. The next N elements will be the nodes which can be anything
#     (A, B, C .. Brick Street, Main Street .. etc.). Then after the Nth element,
#     the rest of the elements in the array will be the connections between all of the nodes.
#     They will look like this: (A-B, B-C .. Brick Street-Main Street .. etc.).
#     Although, there may exist no connections at all.
# 
#     Input example: ["4", "A", "B", "C", "D", "A-B", "B-D", "B-C", "C-D"]
#     Expected output: 'A-B-D'
#     """
# 
#     def __call__(self, str_arr: str) -> Union[str, int]:
#         nodes_count = int(str_arr[0])
#         nodes = str_arr[1:nodes_count + 1]
#         connections = [x.split('-') for x in str_arr[nodes_count + 1:]]
# 
#         _from = nodes[0]
#         _to = nodes[len(nodes) - 1]
#         _adj = self._make_adj_list(connections)
# 
#         traversal = Bfs(_adj, _from)
#         path = traversal.path_to(_to)
# 
#         if not path:
#             return -1
#         return '-'.join(path)
# 
#     # Construct adjacency list, so it could be
#     # consumed by DFS algorithm
#     @staticmethod
#     def _make_adj_list(connections):
#         adj_list = {}
#         for pair in connections:
#             # assign an empty list if not exist yet
#             for x in pair:
#                 if not adj_list.get(x, False):
#                     adj_list[x] = []
#             adj_list[pair[0]].append(pair[1])
#             adj_list[pair[1]].append(pair[0])
#         return adj_list


# Path: tests/py_algorithms/challenges/coderbyte/sp_in_unweigted_graph_test.py
from py_algorithms.challenges.coderbyte.sp_in_unweigted_graph import SPUnweightedCyclicGraph



class TestBinarySearchTreeLca:
    def test_impl(self):
        inputs = {

            'A-B-D': ["4", "A", "B", "C", "D", "A-B", "B-D", "B-C", "C-D"],