lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Dec 13, 2010 at 04:07:32PM +0200, Axel Kittenberger wrote:
> 
> Furthermore I wonder for what the current implementation of # makes
> any sense for an application.
Here is one.

I'm storing the adjacency matrix of a directed graph F as a full array
of sparse arrays: if F[a][b] is not nil, the edge from a to b exists.
I want to program an algorithm from "Combinatorial Algorithms" which
starts:
1. Let a be any node in the graph. -- easy, a=1 will do.
2. Let b be any neighbour of a.    -- easy, b=#F[a]. b==0 means a is isolated.

Think about it.  How else can you do it?

Dirk