A table, the general programming, doesn't have a concept of indexes so accessing by index doesn't make so much sense.
I'm not sure if you want to find by key or value. For key you can use `in`. For value you can use @sls1005's answer. It seems your ids are sequential, so you could use a `seq`. Tables are useful for quick access of the value based on the key, but your indexes are sequential integers, a seq would be **much** faster. Instead of indexes of parents and children, you can use references to them with the `ref` keyword. For breadth first each I would definitely use a seq because you don't need to randomly access them, you just need the "top" of the stack