[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: implementing a DAG using lua tables
- From: "Kevin Baca" <lualist@...>
- Date: Thu, 6 Nov 2003 17:25:48 -0800
Depends if child nodes need to be ordered.
parent.nodes[ node ] = node
table.insert( parent.nodes, node )
The first is better in terms of insert/find/remove efficiency, but child
nodes are not in any dependable order.
> I need to implement a DAG structure(or rather a tree where
> each node can have an arbitrary number of children) using lua
> tables. The table will be traversed from C during every frame
> so it should be as fast as possible to do so. It should also
> be relatively fast and easy to add and remove nodes from the
> DAG. I have thought of a couple of ways to do that but some
> people here have much more experience with LUA so they might
> know of a better/more efficient way to implement a DAG.