#minimumspanningtree — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #minimumspanningtree, aggregated by home.social.
-
CW: Advent of Code 2025 Day 8 Spoilers
There are two kinds of people today: people that know Kruskal's algorithm and people who don't.
If you do, it's pretty simple. Calculate all the distances (you don't even need sqrt since you just need to compare them), sort the pairs by distance, and add them one-by-one to the working set. I used union find to keep track of the connected components as I added edges. Once you've added 1000 edges, get the three biggest connected components and multiply their sizes together for Part 1. Keep adding until the number of non-connected components reaches 1, and then multiply the X coordinates of the last edge you added for Part 2.
If you don't, you probably eventually did something similar but it was a lot more painful. 🙃
Not my fastest solution, but still just over 500ms on my laptop, and the complexity of reducing it wasn't worth it.
https://github.com/biesnecker/aoc-anyhow/blob/main/202508.py
#adventofcode #adventofcode2025 #python #minimumspanningtree #kruskalsalgorithm
-
Minimum spanning tree of a dithered image, 4096 vertices. Model: Swetlana
#spanningtreeyoungandsweet #minimumspanningtree #primsalgorithm #graphtheory #halftoneart #lineart #pythoncode #opengl #algorithmicart #algorist #mathart #laskutaide #computerart #ittaide #kuavataide #iterati
-
Minimum spanning tree of a dithered image, 4096 vertices. Model: Swetlana
#spanningtreeyoungandsweet #minimumspanningtree #primsalgorithm #graphtheory #halftoneart #lineart #pythoncode #opengl #algorithmicart #algorist #mathart #laskutaide #computerart #ittaide #kuavataide #iterati
-
Minimum spanning tree of a dithered image, 4096 vertices. Model: Swetlana
#spanningtreeyoungandsweet #minimumspanningtree #primsalgorithm #graphtheory #halftoneart #lineart #pythoncode #opengl #algorithmicart #algorist #mathart #laskutaide #computerart #ittaide #kuavataide #iterati
-
Minimum spanning tree of a dithered image, 4096 vertices. Model: Swetlana
#spanningtreeyoungandsweet #minimumspanningtree #primsalgorithm #graphtheory #halftoneart #lineart #pythoncode #opengl #algorithmicart #algorist #mathart #laskutaide #computerart #ittaide #kuavataide #iterati
-
Minimum spanning tree of a dithered image, 4096 vertices. Model: Swetlana
#spanningtreeyoungandsweet #minimumspanningtree #primsalgorithm #graphtheory #halftoneart #lineart #pythoncode #opengl #algorithmicart #algorist #mathart #laskutaide #computerart #ittaide #kuavataide #iterati
-
#MinimumSpanningTree #networkx Code at: https://github.com/villares/sketch-a-day/tree/main/2025/sketch_2025_02_08
More sketch-a-day: https://abav.lugaralgum.com/sketch-a-day
If you like this, support my work: https://www.paypal.com/donate/?hosted_button_id=5B4MZ78C9J724 #Processing #Python #py5 #CreativeCoding -
#networkx #MinimumSpanningTree Code at: https://github.com/villares/sketch-a-day/tree/main/2025/sketch_2025_02_07
More sketch-a-day: https://abav.lugaralgum.com/sketch-a-day
If you like this, support my work: https://www.paypal.com/donate/?hosted_button_id=5B4MZ78C9J724 #Processing #Python #py5 #CreativeCoding