I'm trying to understand the aho-corasick string match algorithm. Suppose that our patterns are abcd
and bc
. We end up a tree like this
[]
/\
[a]..[b]
/ : |
[b].: [c]
| :
[c].....
|
[d]
The dotted line show the failure function.
Now supposed that we feed in the string abcd
. This will follow the tree and detect the match "abcd," however, as far as I can tell the match bc
will not be reported. Am I misunderstanding the algorithm?