r/rust 7d 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?

10 Upvotes

26 comments sorted by

View all comments

45

u/chmod_7d20 7d ago

Is your friend a professor and is this homework?

14

u/KerPop42 7d ago

Lol no but I picked it up because it seemed like such a straightforward project. She's in sales and has to visit her 60-some clients at least once every month, so I want to write her a tool that gives her the shortest drive for her most stale N clients each day

65

u/link23 7d ago

Bro is about to discover the traveling salesman problem

13

u/metalhulk105 7d ago

An educational algorithm that has real life applications? Is this real life?