def test_max_suffix_tree_g(): t = make_suffix_trie("ananas") if in_ipynb(): html(graph_to_html(t)) assert num_vertices(t) == 16 for q in vertices(t): assert is_final(q, t) assert not is_final(BOTTOM, t)
def sigma(self, q :int) -> set: return set() if q is BOTTOM or is_final(q, self) else {self.w[q]}
def out_edges(self, q :int): return {} if is_final(q, self) else {EdgeDescriptor(q, q + 1, self.w[q])}
def delta(self, q :int, a :chr): return q + 1 if q is not BOTTOM and not is_final(q, self) and self.w[q] == a else BOTTOM
def update(self, q1 :int, g1 :Trie, q2 :int, g2 :Trie): i = 1 * int(is_final(q1, g1)) + 2 * int(is_final(q2, g2)) self.counters[i] += 1