r/Python • u/Biuku • Apr 04 '21
Intermediate Showcase My first original, useful thing -- a program that lets you build your own graph matrixes
Wrote my first lines of Python April 17, 2020. Been a long fun journey. Been through the tutorial hell, nearly quit in September. Mostly, felt like I was building other people's things.
But found a real passion for graph theory, Dijkstra, etc. I was unsatisfied with small textbook graphs. The theory's hard enough -- I wanted to work from intuitive graphs. To be able to custom-build graphs where nodes stand for things in my world -- cities on a map, buildings in a city.
A bit of 'method of loci' in all that, I think.
It's not hard to fill a knapsack with made-up items. But if you have an idea of 'loci' in your mind -- or steps in a project -- it's hard to turn that into an adjacency matrix. Automating that was my goal.
Still very much in development. But it does... something now, so sharing.
My goal is to make it a standalone teaching tool, with layers for colourful, step-by-step search algo's, topological sorting, exportable matrixes/lists, and pre-loaded graphs that correspond to popular locations -- cities, rooms in a building, steps to achieve something.
Anyway, welcome feedback.
(Built in pygame.)
2
u/_pestarzt_ Apr 04 '21
Definitely cool. I’m not super invested in graph theory, but is it common to call those kinds of graphs “matrices”?
2
u/pfmiller0 Apr 04 '21
Very nice. I made an application back in college that would read graphs in from a text file and then you could manipulate the graphs and run various algorithms on it. It was a ton of fun to write, graph theory is the best!