def _set_suffix_links(self):
        '''
        Sets all suffix links in all nodes in this trie.
        '''
        self._suffix_links_set = True
        for current, parent in self.bfs():
            if parent is None:
                continue
            current.longest_prefix = parent.longest_prefix
            if parent.has_value:
                current.longest_prefix = parent
            if current.has_suffix:
                continue
            suffix = parent
            while True:
                if not suffix.has_suffix:
                    current.suffix = self.root
                    break
                else:
                    suffix = suffix.suffix
                if current.uplink in suffix:
                    current.suffix = suffix[current.uplink]
                    break
            suffix = current.suffix
            while not suffix.has_value and suffix.has_suffix:
                suffix = suffix.suffix
            if suffix.has_value:
                current.dict_suffix = suffix