Beispiel #1
0
    def depth(self, start: str, end: str):
        """
        Depth first node
        :param start: node name
        :param end: node name
        :return:
        """
        start = self.__nodes[start]
        end = self.__nodes[end]

        # Create search stack
        stack = SearchStack()

        # Do a basic search using a stack
        node = SearchAlgo.basic_search(stack, start, end)

        # Build path
        if node:
            # Find path from last node
            return stack.get_path(node)
        else:
            return []
Beispiel #2
0
    def depth(self, start: str, end: str):
        """
        Depth first node
        :param start: node name
        :param end: node name
        :return:
        """
        start = self.__nodes[start]
        end = self.__nodes[end]

        # Create search stack
        stack = SearchStack()

        # Do a basic search using a stack
        node = SearchAlgo.basic_search(stack, start, end)

        # Build path
        if node:
            # Find path from last node
            return stack.get_path(node)
        else:
            return []