AoC - Day 25

:date: 2023-12-25 12:00

Part One

Looking through the other challenges, this caught my eye. The idea was that there was a big graph network but by cutting only 3 edges, you could separate it into two distinct networks. How can those critical edges be found?

Well, I suspected I knew a way. Graphviz is free software that does a superb job of making the most of plotting network graphs in a sane way. I knew it would not be a problem to convert the syntax of the puzzle to Graphviz's dot file syntax.

I did that easily enough which allowed me to produce this fine image.


This allowed me to figure out which three edges/wires needed to be cut. That entailed the following.

$ diff 
< cth-> {dkq xxk dfs}
> cth-> {dkq dfs}
< zdj-> {nvt ffr sxq ftx lvk}
> zdj-> {ffr sxq ftx lvk}
< mzg-> {xln smx bbm}
> mzg-> {xln smx}

Then I used Python's networkx to count up the nodes in Python.


import networkx as nx
G= nx.drawing.nx_pydot.read_dot('')
regions= nx.weakly_connected_components(G)
A= 1
for c in regions: A*= len(c)

And that produced the right answer!

Part Two

There really is not any part two. It is awarded if all other challenges, parts one and two, are complete.