Advent-of-Code-2023/day25/notes.org

979 B

Notes

ok, not so simple

'how to find 3 edges which if removed split graph into 2 components'

i guess i could find all cycles? and then what?

then if i have graph without cycles and all of the removed edges, maybe i can figure out how to remove one edge, to make two components, and all (k - 2) edges back in a way that would not connect those components.

well, the cycles maybe should have been broken elsewhere? for most cycles - it doesn't matter.

for cycles that break into 2 components, does it?

ok. if i have the no-cycle graph. then we can maybe start searching for 'third' edge to remove.

i remove it, i get two components. then as a test - exactly two edges when added should connect those components. if that happens - i have an answer

sounds good

making code to get components.

now.

make method to remove all cycles.

save the removed edges to slice

i guess could be a method that modifies the graph and returns all removed edges. and test that