nfa.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:simone 作者: matheuspb 项目源码 文件源码
def _has_recursion(self, to_visit: str, visited: Set[str]) -> bool:
        """
            Checks if the automata has recursive states, using a depth
            first search approach.
        """
        if to_visit in visited:
                return True

        visited.add(to_visit)
        reachable = set()  # type: Set[str]

        # Find the reachable through all symbols
        for symbol in self._alphabet:
            reachable.update(self._find_reachable({to_visit}, symbol))

        for state in reachable:
            if self._has_recursion(state, copy.deepcopy(visited)):
                return True

        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号