2 algorythms: Spanning tree maker and Aho–Corasick searcher.