For Advent of Code 2023 Day 25, I get a bunch of nodes and wires connecting them. I'll read them into a Graph with the Python networkx library, and then use the Stoer-Wagner algorithm implemented in networkx to get the answer very easily.
Code 2023 AOC: https://gitlab.com/0xdf/aoc2023
Challenge Link: https://adventofcode.com/2023/day/25
Stoer-Wagner: https://en.wikipedia.org/wiki/Stoer%E...
networkx: https://networkx.org/
networkx stoer_wagner: https://networkx.org/documentation/st...
☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf
[00:00] Part 1 description
[01:33] Input analysis
[02:16] Install networkx in venv
[03:12] Prase lines into graph
[03:59] Stoer-Wagner
[05:50] Solve part 1
[06:28] Summary
#adventofcode #python
Смотрите видео Day 25: Snowverload [AOC2023 Python] онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь 0xdf 27 Декабрь 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 260 раз и оно понравилось 9 людям.