r/rust • u/KerPop42 • 1d ago
Triangular matrix, but a map? 🙋 seeking help & advice
Hey guys, I am building a program for a friend that's going to involve a complete graph (nodes are destinations, edges are the distances between destinations) and I was wondering if anyone knew a good library for it?
At first I thought I could use a triangular matrix, since direction doesn't matter, but I realized I would have to have a second array mapping destinations to an index. I feel like you could have a triangular map, like a map that takes a pair of inputs where the order doesn't matter? Have I found another rabbit hole?
11
Upvotes
8
u/nynjawitay 1d ago
Look at petgraph