in reply to
Re: Choosing a data structure for AI applications
in thread Choosing a data structure for AI applications
I don't claim to understand matrices very well, but they seem like a bad solution for this. My understanding is that a matrix will require two bits per connection between two vertices (O(|V2|)). That's for all possible connections. If I have a modest size database of 20,000 facts with an average of 5 vertices per fact, that's 100,000 bits squared. That works out to around 1192 megs of data to store the matrix. If the number of edges (|E|) is extremely large, than matrices start being more attractive, but I suspect that graph representations of AI systems are going to be rather sparse (someone feel free to contradict me on this) which suggests that adjacency lists are preferable).
If I go with adjacency lists, the memory consumption is O(|V|+|E|). This will scale much better.
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.