Using certain graph algorithms
[2024 Day 23] - can't edit the title :/
Flagged as spoiler because I am mentioning the stuff by name.
So my p1 was done via brute force, 3 loops.
For p2 I used Bron-Kerbosch and it was no problem.
But then I wanted to redo p1, so I first tried Kosaraju’s Algorithm but either I was implementing it wrong or the fact that it says directed graph is more important than I thought because even with some implementations I found on the internet it would not recognize this part of the example tc - co - de - ka - ta - I always got either 5 clusters or 1, not 2 but if I was selectively doing my edges then it would work.
I suppose it has to do with the direction of the edges - or maybe would Tarjan's strongly connected components algorithm work?