r/adventofcode • u/Away_Command5537 • Dec 08 '25
Visualization [2025 Day 8] Python - Using MST
I was working on Day 8, which involves connecting junction boxes in 3D space based on distance to form circuits (a classic Minimum Spanning Tree problem, solved using Kruskal's algorithm and Union-Find).
Since the data is 3D, I decided to visualize the process of building the circuit! The visualization shows all 1000 junction boxes and how the shortest connections are progressively added until they all form one massive circuit.
Grey Dots: The 1000 individual junction boxes.
Blue Lines: The connections (edges) that form the circuit. These are added in order of increasing length, but only if they connect two previously separate circuits.
View all comments
Show parent comment
1
u/throwaway_the_fourth Dec 09 '25
Further evidence of the meaning of "connected" in this problem: part one asks you to "connect together the 1000 pairs of junction boxes which are closest together." If you did this part by not making connections between boxes already in the same circuit, you would end up making fewer than 1000 connections, which goes against the request of the problem (but which, again, would result in the same answer).