title: how to find the indexes of all matching substring using suffix tree?
body: <p>I created a suffix tree from this amazing <a href="https://stackoverflow.com/questions/9452701/ukkonens-suffix-tree-algorithm-in-plain-english">answer</a>. It works like a charm!</p>
  
  <p>For now, if I look for "cat" in "This cat is a pretty cat", it will return 5 as "cat" first appearance as for starting index 5.</p>
  
  <p>But I can't find a way to keep track of all the suffixes in the algorithm to create. So basically, I can find the index of the first match, but not all the different occurrences.</p>
  
  <p>For now, I have:</p>
  
  <pre><code>class Edge
  {
      int textIndexFrom;
      Node* nodefrom;
      Node* nodeTo;
      int textIndexTo;
  }
  
  class Node
  {
      std::map&lt;char,Edge*&gt; m_childEdges;
      Edge* m_pParentEdge;
      Node* m_pLinkedNode;
  }
  </code></pre>
  
  <p>I just put the relevant variables in the code above. To store the different starting positions, I imagine a std::vector is needed in Edge, but I don't see when to add a new index. We might use the active point but with the suffix links, it becomes tricky.</p>
  
  <p>Could someone explain?</p>