title: Data structure for simulation of a NFA
body: <p>I'm trying to figure out the best data structure for this, I tried a dict but seems not the better choice.</p>
  
  <pre><code>(0, ''): [0, 1, 3], (1, 'a'): 2, (2, ''): [2, 1, 3], (3, 'b'): 4
  </code></pre>
  
  <p>Inside the lists there are the <code>ε-moves</code>, but when I don't put them it's hard to implement the <code>ε-closure</code> function. </p>
  
  <p>I'm trying to implement a algorithm like this from the Dragon's Book:
  <img src="https://i.stack.imgur.com/GajeZ.png" alt="enter image description here"></p>
  
  <p>I have no idea how I can implement the <code>ε-closure</code> in a Python way.</p>
  
  <p>Regex: <code>a*b</code></p>
  
  <p><img src="https://i.stack.imgur.com/ALiHv.png" alt="enter image description here"></p>
  
  <p>Maybe a linked list? Thanks for examples.</p>