don't use sparse array for transaction
use a different variable name in clear method
use a traditional for loop instead of for..in for neighbors counting
use hasOwnProperty