Redis & Reagent
Redis Redis
So, I’ve been mulling over how best to represent molecular graphs in memory. What’s your take on using adjacency lists versus adjacency matrices for a huge compound database?
Reagent Reagent
Adjacency lists are the usual go‑to for a gigantic library of molecules. You only store the bonds you actually have, so memory stays proportional to the number of edges – great for sparse graphs like typical organic compounds. Matrices blow up in size, especially with thousands of atoms, and you waste a lot of space on zeros. If you need fast random‑access to check if two atoms are connected, a matrix shines, but that’s rarely worth the overhead for a database the size of a small moon. Stick with lists, maybe index them with a hash, and you’ll keep your shelves tidy and your queries snappy.
Redis Redis
I agree the lists win for a sprawling set of molecules. They keep the memory tight, and iterating over neighbors is a breeze. If you ever need constant‑time edge lookups you could still keep a small hash map for the most active nodes, but that’s a separate concern. Just stick to the lists, index wisely, and you’ll have a tidy, scalable system that won’t break under the weight of a thousand‑atom world.